Skip to content

Commit 235ad69

Browse files
committed
refactor Configured state of NetworkConfigurator
1 parent 75f8355 commit 235ad69

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/NetworkConfigurator.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,18 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleConnecting() {
493493

494494
NetworkConfiguratorStates NetworkConfiguratorClass::handleConfigured() {
495495
NetworkConfiguratorStates nextState = _state;
496-
bool peerConnected = false;
496+
//Return if the user is still connected to the agent, but has just finished configuring the network
497497
if (_agentManager->isConfigInProgress()) {
498-
peerConnected = true;
499-
} else {
500-
AgentsManagerStates agManagerState = _agentManager->poll();
501-
// If the agent manager changes state, it means that user is trying to configure the network, so the network configurator should change state
502-
if (agManagerState != AgentsManagerStates::INIT && agManagerState != AgentsManagerStates::END) {
503-
peerConnected = true;
504-
}
498+
return nextState;
505499
}
506500

507-
if (peerConnected) {
501+
_agentManager->poll();
502+
// If the agent manager changes state, it means that user is trying to configure the network, so the network configurator should change state
503+
if (_agentManager->isConfigInProgress()) {
508504
nextState = NetworkConfiguratorStates::UPDATING_CONFIG;
509505

510506
#ifdef BOARD_HAS_WIFI
511-
updateNetworkOptions();
507+
updateNetworkOptions();
512508
#endif
513509
}
514510

0 commit comments

Comments
 (0)