From f1cdaea3b87caa96bbf9b8c6d4980233c7e482b8 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Windows 11)" <rob@synchro.net> Date: Sat, 9 Nov 2024 20:26:01 -0800 Subject: [PATCH] Don't check recvline() timeout *before* checking if there's data to receive This was a regression: Socket.recvline() used to not care what the timeout duration was so long as there were bytes to receive. Also, remove the ".0" from timeout values in documented mehtods that don't (any longer) accept floating point timeout durations. We used to support fractional seconds for some of these methods, and that was implied by using the floating point default values, but that's no longer the case. poll() still accepts a floating point timeout. --- src/sbbs3/js_socket.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/sbbs3/js_socket.c b/src/sbbs3/js_socket.c index 34975d70c0..437ad4b196 100644 --- a/src/sbbs3/js_socket.c +++ b/src/sbbs3/js_socket.c @@ -1656,11 +1656,6 @@ js_sock_read_check(js_socket_private_t *p, time_t start, int32 timeout, int i) { bool rd; - if(timeout > 0 && time(NULL)-start>timeout) { - dbprintf(false, p, "recvline timeout (received: %d)",i); - return 1; - } - if(!socket_check(p->sock,&rd,NULL,1000)) { store_socket_error(p, ERROR_VALUE, NULL); return 2; @@ -2646,9 +2641,9 @@ static jsSyncMethodSpec js_socket_functions[] = { "optionally specifying a network interface (via <i>ip_address</i>)") ,311 }, - {"connect", js_connect, 2, JSTYPE_BOOLEAN, JSDOCSTR("host, port [,timeout=10.0] [,callback]") + {"connect", js_connect, 2, JSTYPE_BOOLEAN, JSDOCSTR("host, port [,timeout=10] [,callback]") ,JSDOCSTR("Connect to a remote port (number or service name) on the specified host (IP address or host name)" - ", default <i>timeout</i> value is <i>10.0</i> (seconds). Instead of a timeout, you can pass a <i>callback</i> " + ", default <i>timeout</i> value is <i>10</i> (seconds). Instead of a timeout, you can pass a <i>callback</i> " "which is called when the connection completes with the Socket object as the only parameter.") ,311 }, -- GitLab