AmendHub

Download:

jcs

/

subtext

/

amendments

/

156

telnet: Don't abort TCP connection while there is an active session

telnet_idle is called outside of a uthread so just set session ending
and let it tear itself down once that thread is scheduled again

jcs made amendment 156 over 2 years ago
--- telnet.c Fri Jun 17 14:47:24 2022 +++ telnet.c Tue Jun 21 13:13:29 2022 @@ -296,12 +296,15 @@ telnet_idle(void) logger_printf(logger, "[%s] Telnet connection from " "%s in state %d, aborting", node->name, node->ip_s, telnet_status_pb.connectionState); - - _TCPRelease(&node->listen_pb, node->stream, nil, nil, - false); - - telnet_nodes[n] = telnet_listener_node = NULL; - free(node); + + if (node->session) + node->session->ending = 1; + else { + _TCPRelease(&node->listen_pb, node->stream, nil, nil, + false); + telnet_nodes[n] = telnet_listener_node = NULL; + free(node); + } goto next_node; } break;