Skip to content

Commit

Permalink
Restore state before restart dnssd (#31985)
Browse files Browse the repository at this point in the history
* Restore state before restart dnssd

* Needs to call Shutdown
  • Loading branch information
tianfeng-yang authored Feb 20, 2024
1 parent 19c49a8 commit f7baa58
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/dnssd/Discovery_ImplPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,13 @@ void DiscoveryImplPlatform::HandleDnssdInit(void * context, CHIP_ERROR initError

void DiscoveryImplPlatform::HandleDnssdError(void * context, CHIP_ERROR error)
{
DiscoveryImplPlatform * publisher = static_cast<DiscoveryImplPlatform *>(context);

if (error == CHIP_ERROR_FORCED_RESET)
{
// Restore dnssd state before restart, also needs to call ChipDnssdShutdown()
publisher->Shutdown();

DeviceLayer::ChipDeviceEvent event;
event.Type = DeviceLayer::DeviceEventType::kDnssdRestartNeeded;
error = DeviceLayer::PlatformMgr().PostEvent(&event);
Expand Down

0 comments on commit f7baa58

Please sign in to comment.