Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mdns] unify the behavior of Stop() between avahi and mDNSResponder #2725

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

superwhd
Copy link
Contributor

In the Stop() method, the Publisher will:

  1. Early exit if it's already stopped.
  2. Mark the state as stopped and trigger callbacks.
  3. Clear registrations and subscriptions. The destructors will free the mDNS library's client-side objects.

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 45.21%. Comparing base (2b41187) to head (6e1f5c9).
Report is 952 commits behind head on main.

Files with missing lines Patch % Lines
src/mdns/mdns_avahi.cpp 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2725       +/-   ##
===========================================
- Coverage   55.77%   45.21%   -10.57%     
===========================================
  Files          87      108       +21     
  Lines        6890    13417     +6527     
  Branches        0      964      +964     
===========================================
+ Hits         3843     6066     +2223     
- Misses       3047     7025     +3978     
- Partials        0      326      +326     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@superwhd superwhd marked this pull request as ready for review February 20, 2025 02:23
@superwhd superwhd requested review from abtink and removed request for abtink February 20, 2025 02:24
VerifyOrExit(mState == State::kReady);

mState = State::kIdle;
mStateCallback(mState);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this callback be called after everything is cleared?

@@ -241,6 +241,9 @@ void PublisherMDnsSd::Stop(StopMode aStopMode)
{
VerifyOrExit(mState == State::kReady);

mState = State::kIdle;
mStateCallback(mState);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to clear states and then update the state and trigger callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants