Skip to content

Commit

Permalink
[Darwin] Call ResetSharedConnection and not StartSharedConnection in …
Browse files Browse the repository at this point in the history
…src/platform/Darwin/DnssdHostNameRegistrar.cpp in order to properly unregister / register interfaces addresses (#22810)
  • Loading branch information
vivien-apple authored and pull[bot] committed Aug 7, 2023
1 parent 835be19 commit a65c958
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/platform/Darwin/DnssdHostNameRegistrar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ CHIP_ERROR HostNameRegistrar::Register()
VerifyOrReturnError(!IsLocalOnly(), CHIP_NO_ERROR);

return StartMonitorInterfaces(^(InetInterfacesVector inetInterfaces, Inet6InterfacesVector inet6Interfaces) {
ReturnOnFailure(StartSharedConnection());
ReturnOnFailure(ResetSharedConnection());
RegisterInterfaces(inetInterfaces, kDNSServiceType_A);
RegisterInterfaces(inet6Interfaces, kDNSServiceType_AAAA);
});
Expand Down Expand Up @@ -355,6 +355,8 @@ void HostNameRegistrar::StopMonitorInterfaces()

CHIP_ERROR HostNameRegistrar::StartSharedConnection()
{
VerifyOrReturnError(mServiceRef == nullptr, CHIP_ERROR_INCORRECT_STATE);

auto err = DNSServiceCreateConnection(&mServiceRef);
VerifyOrReturnValue(kDNSServiceErr_NoError == err, Error::ToChipError(err));

Expand Down

0 comments on commit a65c958

Please sign in to comment.