Skip to content

Commit 0dba1ac

Browse files
committed
when Avahi is registering, there is no need to reset, also can try dns resolve.
1 parent 8f2a4d2 commit 0dba1ac

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/lib/dnssd/Discovery_ImplPlatform.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ CHIP_ERROR DiscoveryImplPlatform::ResolveNodeId(const PeerId & peerId)
631631
{
632632
// Resolve requests can only be issued once DNSSD is initialized and there is
633633
// no caching currently
634-
VerifyOrReturnError(mState == State::kInitialized, CHIP_ERROR_INCORRECT_STATE);
634+
// When the DNSSD is kInitializing, can also try to resolve.
635+
VerifyOrReturnError(mState != State::kUninitialized, CHIP_ERROR_INCORRECT_STATE);
635636

636637
ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...",
637638
ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId()));

src/platform/Linux/DnssdImpl.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,15 @@ void MdnsAvahi::HandleClientState(AvahiClient * client, AvahiClientState state)
386386
mErrorCallback(mAsyncReturnContext, CHIP_ERROR_INTERNAL);
387387
break;
388388
case AVAHI_CLIENT_S_COLLISION:
389-
case AVAHI_CLIENT_S_REGISTERING:
390-
ChipLogProgress(DeviceLayer, "Avahi re-register required");
389+
ChipLogProgress(DeviceLayer, "Avahi collision, force to reset");
391390
StopPublish();
392391
mErrorCallback(mAsyncReturnContext, CHIP_ERROR_FORCED_RESET);
392+
// Should restart the resolve service of the host.
393+
break;
394+
case AVAHI_CLIENT_S_REGISTERING:
395+
// now is registering, we should just StopPublish() without reset
396+
ChipLogProgress(DeviceLayer, "Avahi registering");
397+
StopPublish();
393398
break;
394399
case AVAHI_CLIENT_CONNECTING:
395400
ChipLogProgress(DeviceLayer, "Avahi connecting");

0 commit comments

Comments
 (0)