| 640 | // Disconnect client |
| 641 | |
| 642 | void RemoteDebug::disconnect(boolean onlyTelnetClient) { |
| 643 | |
| 644 | // Disconnect |
| 645 | |
| 646 | if (onlyTelnetClient) { |
| 647 | if (_connected) { |
| 648 | TelnetClient.println("* Closing client connection ..."); // this is to web app new conn not receive it |
| 649 | } |
| 650 | } else { |
| 651 | debugPrintln("* Closing client connection ..."); |
| 652 | } |
| 653 | |
| 654 | _silence = false; |
| 655 | _silenceTimeout = 0; |
| 656 | |
| 657 | if (_connected) { // By telnet |
| 658 | TelnetClient.stop(); |
| 659 | _connected = false; |
| 660 | } |
| 661 | #ifndef WEBSOCKET_DISABLED // For web socket server (app) |
| 662 | if (_connectedWS && !onlyTelnetClient) { |
| 663 | DebugWS.disconnect(); // Disconnect client |
| 664 | _connectedWS = false; |
| 665 | } |
| 666 | #endif |
| 667 | } |
| 668 | |
| 669 | // Connection/disconnection event |
| 670 | |