Commit afafff2f authored by deuce's avatar deuce
Browse files

Update Socket.recvline() for new js_socket_recv() TLS semantics.

Fixes recvline() returning an zero-length "line" on timeouts, which causes
infinite loops and 100% CPU utilization with IMAPv4-TLS service (and likely
any other service that uses recvline with a short timeout).
parent a97ca06b
......@@ -1331,7 +1331,6 @@ js_recvline(JSContext *cx, uintN argc, jsval *arglist)
start=time(NULL);
rc=JS_SUSPENDREQUEST(cx);
for(i=0;i<len;) {
if(p->session==-1) {
switch(js_sock_read_check(p,start,timeout,i)) {
case 1:
......@@ -1353,20 +1352,12 @@ js_recvline(JSContext *cx, uintN argc, jsval *arglist)
break;
}
else {
if (got == -1) {
len = 0;
continue;
}
switch(js_sock_read_check(p,start,timeout,i)) {
case 1:
JS_SET_RVAL(cx, arglist, JSVAL_NULL);
JS_RESUMEREQUEST(cx, rc);
if (got == 0) {
free(buf);
return(JS_TRUE); /* time-out */
case 2:
len=0;
continue;
case 3:
}
if (got == -1) {
len = 0;
continue;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment