From 34177b042038db9c27d96e462796e45866e80673 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Fri, 26 May 2023 02:17:18 +0900 Subject: [PATCH] Fixed disconnect crash/loop --- src/Home/Net/Programs/Telnet/Telnet.ZC | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Home/Net/Programs/Telnet/Telnet.ZC b/src/Home/Net/Programs/Telnet/Telnet.ZC index 26e9e8b3..ba9e27df 100755 --- a/src/Home/Net/Programs/Telnet/Telnet.ZC +++ b/src/Home/Net/Programs/Telnet/Telnet.ZC @@ -681,7 +681,7 @@ U0 ANSIParse() } U0 TerminalTask() { - while (!term.sock_ready) { + while (!term.sock_ready) { Sleep(100); // Avoid busy waiting } @@ -907,16 +907,13 @@ init_connection: case CH_BACKSPACE: if (term.sock_ready) TCPSocketSendString(term.sock, "\x08\x7F"); break; - case CH_ESC: - if (term.sock_ready) TCPSocketSendString(term.sock, "\x1B"); - break; case CH_SHIFT_ESC: if (term.sock_ready) { - if (term.sock_ready) TCPSocketClose(term.sock); - host = NULL; - term.sock_ready = 0; term.waiting_for_input = TRUE; + term.sock_ready = 0; + host = NULL; + TCPSocketClose(term.sock); DocClear; "Telnet connection closed.\n"; Sleep(100); @@ -925,6 +922,9 @@ init_connection: else force_disconnect = TRUE; break; + case CH_ESC: + if (term.sock_ready) TCPSocketSendString(term.sock, "\x1B"); + break; // send buffer on enter case '\n': if (term.sock_ready) TCPSocketSendString(term.sock, "\r\n");