Skip to content
Snippets Groups Projects
Commit f1cdaea3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

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.
parent c9ec49e0
No related branches found
No related tags found
No related merge requests found
Pipeline #7092 failed
......@@ -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
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment