Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
superwhd committed Feb 18, 2025
1 parent e2f3c1f commit d87cd6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/mdns/mdns_avahi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ bool PublisherAvahi::IsStarted(void) const

void PublisherAvahi::Stop(void)
{
VerifyOrExit(mState == State::kReady);

mState = State::kIdle;
mStateCallback(mState);

mServiceRegistrations.clear();
mHostRegistrations.clear();

Expand All @@ -531,7 +536,8 @@ void PublisherAvahi::Stop(void)
mClient = nullptr;
}

mState = Mdns::Publisher::State::kIdle;
exit:
return;
}

void PublisherAvahi::HandleClientState(AvahiClient *aClient, AvahiClientState aState, void *aContext)
Expand Down
5 changes: 3 additions & 2 deletions src/mdns/mdns_mdnssd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ void PublisherMDnsSd::Stop(StopMode aStopMode)
{
VerifyOrExit(mState == State::kReady);

mState = State::kIdle;
mStateCallback(mState);

// If we get a `kDNSServiceErr_ServiceNotRunning` and need to
// restart the `Publisher`, we should immediately de-allocate
// all `ServiceRef`. Otherwise, we first clear the `Registrations`
Expand All @@ -265,8 +268,6 @@ void PublisherMDnsSd::Stop(StopMode aStopMode)
mSubscribedServices.clear();
mSubscribedHosts.clear();

mState = State::kIdle;

exit:
return;
}
Expand Down

0 comments on commit d87cd6a

Please sign in to comment.