Skip to content

Commit

Permalink
[server] Remove redundant call to "advertiseOperational" (project-chi…
Browse files Browse the repository at this point in the history
…p#7254)

PR project-chip#6798 added another call to "advertiseOpertional()" which
starts publishing the opertional node service on a receipt
of a valid EnableNetwork command. Consequently, the code
which publishes the same service on a change in the network
configuration became redundant and actually harmful due to
some issues with updating an SRP service.
  • Loading branch information
Damian-Nordic authored Jun 1, 2021
1 parent a87bc4f commit 17f00e0
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,34 +444,6 @@ CHIP_ERROR OpenDefaultPairingWindow(ResetAdmins resetAdmins, chip::PairingWindow
return gRendezvousServer.WaitForPairing(std::move(params), &gExchangeMgr, &gTransports, &gSessions, adminInfo);
}

#if CHIP_DEVICE_CONFIG_ENABLE_MDNS && !CHIP_DEVICE_LAYER_TARGET_ESP32
static void ChipEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t)
{
const auto advertise = [] {
CHIP_ERROR err = app::Mdns::AdvertiseOperational();
if (err != CHIP_NO_ERROR)
ChipLogError(AppServer, "Failed to start operational advertising: %s", chip::ErrorStr(err));
};

switch (event->Type)
{
case DeviceLayer::DeviceEventType::kInternetConnectivityChange:
VerifyOrReturn(event->InternetConnectivityChange.IPv4 == DeviceLayer::kConnectivity_Established);
// TODO : Need to check if we're properly commissioned.
advertise();
break;
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
case DeviceLayer::DeviceEventType::kThreadStateChange:
VerifyOrReturn(event->ThreadStateChange.AddressChanged);
advertise();
break;
#endif
default:
break;
}
}
#endif

// The function will initialize datamodel handler and then start the server
// The server assumes the platform's networking has been setup already
void InitServer(AppDelegate * delegate)
Expand Down Expand Up @@ -558,7 +530,6 @@ void InitServer(AppDelegate * delegate)
// ESP32 examples have a custom logic for enabling DNS-SD
#if CHIP_DEVICE_CONFIG_ENABLE_MDNS && !CHIP_DEVICE_LAYER_TARGET_ESP32
app::Mdns::StartServer();
PlatformMgr().AddEventHandler(ChipEventHandler, {});
#endif

gCallbacks.SetSessionMgr(&gSessions);
Expand Down

0 comments on commit 17f00e0

Please sign in to comment.