Subj : src/sbbs3/main.cpp To : Git commit to main/sbbs/master From : Rob Swindell (on Windows) Date : Fri Jun 02 2023 17:49:52 https://gitlab.synchro.net/main/sbbs/-/commit/ca7ab040466b030281a9aaca Modified Files: src/sbbs3/main.cpp Log Message: Add a 60-second timeout to sbbs_t::passthru_socket_activate()Keyop reported an issue via irc whereby a user that failed to download a filewould leave the node "hung" in "downloading via telnet" node status eventhough the user had long since disconnected and the log reflected that theterminal server was aware of this:term Node 4 sexyz: !1152 zmodem_recv_raw TIMEOUT (10 seconds)term Node 4 sexyz: !zmodem_recv_header TIMEOUTterm Node 4 external Timeout waiting for output buffer to emptyterm Node 4 connection reset by peer on sendterm Node 4 !ERROR 32 sending on socket 102term Node 4 !ERROR 32 sending on socket 102term Node 4 !ERROR 32 sending on socket 102term Node 4 !ERROR 32 sending on socket 102term Node 4 !ERROR 32 sending on socket 102term Node 4 disconnectedterm Node 4 !ERROR 32 sending on socket 102andterm Node 3 sexyz: !1152 zmodem_recv_raw TIMEOUT (10 seconds)term Node 3 sexyz: !zmodem_recv_header TIMEOUTterm Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !Receive timeout (1 seconds)term Node 3 sexyz: !1152 zmodem_recv_raw TIMEOUT (10 seconds)term Node 3 sexyz: !zmodem_recv_header TIMEOUTterm Node 3 external Timeout waiting for output buffer to emptyterm Node 3 connection reset by peer on receiveterm Node 3 !ERROR 32 sending on socket 96These nodes were then locked up in call to passthru_socket_activate(false)as reported by gdb, e.g.Looking at passthru_socket_activate(), the deactivation path (called at theend of external() in this case), it was clear that this could be an infiniteloop in the case the user had disconnected: do { // Allow time for the passthru_thread to move any pending socket data to the outbuf SLEEP(100); // Before the node_thread starts sending its own data to the outbuf } while(RingBufFull(&outbuf));These flush/purge loops aren't strictly needed if the user has disconnected,but as can be seen by the above logs, the terminal server may not know that(the socket may not indicate disconnect) before passthru_socket_activate()is called by external().So... worst case, just do the activation and deactivation buffer flushesand purges for 60 seconds. --- SBBSecho 3.20-Linux * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705) .