File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -112,18 +112,7 @@ void WiFiConnectionHandler::update() {
112112 case NetworkConnectionState::CONNECTED: update_handleConnected (networkStatus); break ;
113113 case NetworkConnectionState::GETTIME: update_handleGetTime (); break ;
114114 case NetworkConnectionState::DISCONNECTING: update_handleDisconnecting (networkStatus); break ;
115- case NetworkConnectionState::DISCONNECTED: {
116- #if !defined(BOARD_ESP8266)
117- WiFi.end ();
118- #endif
119- if (keepAlive) {
120- changeConnectionState (NetworkConnectionState::INIT);
121- } else {
122- changeConnectionState (NetworkConnectionState::CLOSED);
123- }
124-
125- }
126- break ;
115+ case NetworkConnectionState::DISCONNECTED: update_handleDisconnected (); break ;
127116 case NetworkConnectionState::ERROR: {
128117
129118 }
@@ -300,4 +289,16 @@ void WiFiConnectionHandler::update_handleDisconnecting(int const networkStatus)
300289 }
301290}
302291
292+ void WiFiConnectionHandler::update_handleDisconnected () {
293+ #ifndef BOARD_ESP8266
294+ WiFi.end ();
295+ #endif /* ifndef BOARD_ESP8266 */
296+ if (keepAlive) {
297+ changeConnectionState (NetworkConnectionState::INIT);
298+ }
299+ else {
300+ changeConnectionState (NetworkConnectionState::CLOSED);
301+ }
302+ }
303+
303304#endif /* #ifdef BOARD_HAS_WIFI */
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ class WiFiConnectionHandler : public ConnectionHandler {
8989 void update_handleConnected (int & networkStatus);
9090 void update_handleGetTime ();
9191 void update_handleDisconnecting (int const networkStatus);
92+ void update_handleDisconnected ();
9293
9394};
9495
You can’t perform that action at this time.
0 commit comments