# HG changeset patch # User Atul Varma # Date 1245885012 25200 # Node ID 45fd970860f2e344e951116f2bf774a9de206f25 # Parent aabc1dd92639bd84fd97f011dd4ca91e13bdf55f Added calls to JS_SuspendRequest() and JS_ResumeRequest() around blocking NSPR network calls. diff -r aabc1dd92639 -r 45fd970860f2 server_socket.cpp --- a/server_socket.cpp Wed Jun 24 15:58:54 2009 -0700 +++ b/server_socket.cpp Wed Jun 24 16:10:12 2009 -0700 @@ -105,9 +105,11 @@ if (!getSocket(cx, obj, &fd)) return JS_FALSE; + jsrefcount rc = JS_SuspendRequest(cx); PRInt32 sent = PR_Send(fd, dataBytes, dataLength, 0, PR_INTERVAL_NO_TIMEOUT); - + JS_ResumeRequest(cx, rc); + if (sent == -1) { JS_ReportError(cx, "Send failed."); return JS_FALSE; @@ -131,7 +133,9 @@ return JS_FALSE; char buffer[length]; + jsrefcount rc = JS_SuspendRequest(cx); PRInt32 recvd = PR_Recv(fd, buffer, length, 0, PR_INTERVAL_NO_TIMEOUT); + JS_ResumeRequest(cx, rc); if (recvd == -1) { JS_ReportError(cx, "Receive failed."); @@ -208,7 +212,10 @@ return JS_FALSE; PRNetAddr addr; + + jsrefcount rc = JS_SuspendRequest(cx); PRFileDesc *conn = PR_Accept(fd, &addr, timeout); + JS_ResumeRequest(cx, rc); if (conn == NULL) { *rval = JSVAL_NULL;