Skip to content

Commit

Permalink
[Telink] Move SetRouterPromotion(false) at the end of OpenCommissioni…
Browse files Browse the repository at this point in the history
…ngWindow (#25517)

* [Telink] Move SetRouterPromotion(false) at the end of OpenCommissioningWindow

* [Telink] Add comment for AdvertiseAndListenForPASE fail case
  • Loading branch information
s07641069 authored and pull[bot] committed Oct 26, 2023
1 parent 9f27e46 commit 1827044
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ CHIP_ERROR CommissioningWindowManager::OpenCommissioningWindow(Seconds16 commiss

mCommissioningTimeoutTimerArmed = true;

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD
// Block device role changing into Router if commissioning window opened and device not yet Router.
// AdvertiseAndListenForPASE fails doesn't matter, because if it does the callers of OpenCommissioningWindow
// will end up calling ResetState, which will reset the boolean.
if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router)
{
ThreadStackMgr().SetRouterPromotion(false);
mRecoverRouterDeviceRole = true;
}
#endif

return AdvertiseAndListenForPASE();
}

Expand Down Expand Up @@ -470,15 +481,6 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement()
// reset all advertising, switching to our new commissioning mode.
app::DnssdServer::Instance().StartServer();

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD
// Block device role changing into Router if commissioning window opened and device not yet Router.
if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router)
{
ThreadStackMgr().SetRouterPromotion(false);
mRecoverRouterDeviceRole = true;
}
#endif

return CHIP_NO_ERROR;
}

Expand Down

0 comments on commit 1827044

Please sign in to comment.