Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abtink committed Sep 11, 2023
1 parent 127cdee commit 13a0410
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mdns/mdns_mdnssd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ void PublisherMDnsSd::Process(const MainloopContext &aMainloop)
if (error == kDNSServiceErr_ServiceNotRunning)
{
otbrLogWarning("Need to reconnect to mdnsd");

if (mHostsRef != nullptr)
{
DNSServiceRefDeallocate(mHostsRef);
mHostsRef = nullptr;
}

Stop();
Start();
ExitNow();
Expand Down Expand Up @@ -400,6 +407,7 @@ PublisherMDnsSd::DnssdHostRegistration::~DnssdHostRegistration(void)
{
int dnsError;

VerifyOrExit(GetPublisher().mHostsRef != nullptr);
VerifyOrExit(mServiceRef != nullptr);

for (const auto &recordRefAndAddress : GetRecordRefMap())
Expand Down
2 changes: 2 additions & 0 deletions src/mdns/mdns_mdnssd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class PublisherMDnsSd : public MainloopProcessor, public Publisher
std::map<DNSRecordRef, Ip6Address> &GetRecordRefMap() { return mRecordRefMap; }

private:
PublisherMDnsSd &GetPublisher(void) { return *static_cast<PublisherMDnsSd *>(mPublisher); }

DNSServiceRef mServiceRef;

public:
Expand Down

0 comments on commit 13a0410

Please sign in to comment.