@@ -576,8 +576,9 @@ void RemoteDebug::handle() {
576576 if (_password != " " && !_passwordOk) { // Request password - 18/08/08
577577 maxTime = 60000 ; // One minute to password
578578 }
579+ else maxTime = connectionTimeout; // When password is ok set normal timeout
579580
580- if ((millis () - _lastTimeCommand) > maxTime) {
581+ if ((maxTime > 0 ) && (( millis () - _lastTimeCommand) > maxTime) ) {
581582
582583 debugPrintln (" * Closing session by inactivity" );
583584
@@ -1326,6 +1327,7 @@ void RemoteDebug::showHelp() {
13261327 help.concat (" s -> set debug silence on/off\r\n " );
13271328 help.concat (" l -> show debug level\r\n " );
13281329 help.concat (" t -> show time (millis)\r\n " );
1330+ help.concat (" timeout -> set connection timeout (sec, 0 = disabled)\r\n " );
13291331 help.concat (" profiler:\r\n " );
13301332 help.concat (
13311333 " p -> show time between actual and last message (in millis)\r\n " );
@@ -1617,6 +1619,20 @@ void RemoteDebug::processCommand() {
16171619
16181620 debugPrintf (" * Show time: %s\r\n " , (_showTime) ? " On" : " Off" );
16191621
1622+ } else if (_command.startsWith (" timeout" )) {
1623+
1624+ // Set or get connection timeout
1625+
1626+ if (options.length () > 0 ) { // With minimal time
1627+ if ((options.toInt () >= 60 ) || (options.toInt () == 0 )) {
1628+ connectionTimeout = options.toInt () * 1000 ;
1629+ }
1630+ else {
1631+ debugPrintf (" * Connection Timeout must be minimal 60 seconds.\r\n " );
1632+ }
1633+ }
1634+ debugPrintf (" * Connection Timeout: %d seconds (0=disabled)\r\n " , connectionTimeout/1000 );
1635+
16201636 } else if (_command == " s" ) {
16211637
16221638 // Toogle silence (new) = 28/08/18
0 commit comments