Fix telnet bug

This commit is contained in:
fvanroie 2020-12-17 22:27:03 +01:00
parent dbef094f01
commit c51e5e98bb

View File

@ -43,8 +43,8 @@ void telnetClientDisconnect()
Log.unregisterOutput(1); // telnetClient Log.unregisterOutput(1); // telnetClient
telnetLoginState = TELNET_UNAUTHENTICATED; telnetLoginState = TELNET_UNAUTHENTICATED;
telnetLoginAttempt = 0; // Initial attempt telnetLoginAttempt = 0; // Initial attempt
delete telnetConsole; // delete telnetConsole;
telnetConsole = NULL; // telnetConsole = NULL;
telnetClient.stop(); telnetClient.stop();
} }
@ -295,10 +295,12 @@ void IRAM_ATTR telnetLoop()
Log.warning(TAG_TELN, F("Rejecting client, another connection is already active")); Log.warning(TAG_TELN, F("Rejecting client, another connection is already active"));
telnetServer->available().stop(); // already have a client, block new connections telnetServer->available().stop(); // already have a client, block new connections
} }
} } else {
#endif if(!telnetClient.connected() && telnetLoginState != TELNET_UNAUTHENTICATED) {
telnetClientDisconnect(); // active client disconnected
} else {
/* Process user input */ /* Active Client: Process user input */
if(telnetConsole) { if(telnetConsole) {
int16_t keypress = telnetConsole->readKey(); int16_t keypress = telnetConsole->readKey();
switch(keypress) { switch(keypress) {
@ -306,6 +308,10 @@ void IRAM_ATTR telnetLoop()
break; break;
} }
} }
}
}
#endif
} }
bool telnetGetConfig(const JsonObject & settings) bool telnetGetConfig(const JsonObject & settings)