Bug 868803: Obviate PR_Sleep during socket connect on Windows, r=wtc
authorBrian Smith <bsmith@mozilla.com>
Mon, 06 May 2013 14:07:23 -0700
changeset 10767 776fced32705ef7b3f4d7bf314c4538ac8367019
parent 10766 cf3b9b27172ea4466692024944054748ad88d876
child 10768 0babcec0543a3b75fe54ad37c91a186d1aa0233c
push id76
push userbsmith@mozilla.com
push dateMon, 06 May 2013 21:08:30 +0000
reviewerswtc
bugs868803
Bug 868803: Obviate PR_Sleep during socket connect on Windows, r=wtc
cmd/tstclnt/tstclnt.c
lib/ssl/sslsock.c
--- a/cmd/tstclnt/tstclnt.c
+++ b/cmd/tstclnt/tstclnt.c
@@ -1249,21 +1249,16 @@ int main(int argc, char **argv)
 		}
 		FPRINTF(stderr,
 		        "%s: PR_Poll returned 0x%02x for socket out_flags.\n",
 			progName, pollset[SSOCK_FD].out_flags);
 		if (filesReady == 0) {	/* shouldn't happen! */
 		    FPRINTF(stderr, "%s: PR_Poll returned zero!\n", progName);
 		    return 1;
 		}
-		/* Must milliPause between PR_Poll and PR_GetConnectStatus,
-		 * Or else winsock gets mighty confused.
-		 * Sleep(0);
-		 */
-		milliPause(1);
 		status = PR_GetConnectStatus(pollset);
 		if (status == PR_SUCCESS) {
 		    break;
 		}
 		if (PR_GetError() != PR_IN_PROGRESS_ERROR) {
 		    SECU_PrintError(progName, "unable to connect (poll)");
 		    return 1;
 		}
--- a/lib/ssl/sslsock.c
+++ b/lib/ssl/sslsock.c
@@ -1384,19 +1384,16 @@ ssl_ImportFD(PRFileDesc *model, PRFileDe
     	return NULL;
 
     rv = ssl_PushIOLayer(ns, fd, PR_TOP_IO_LAYER);
     if (rv != PR_SUCCESS) {
 	ssl_FreeSocket(ns);
 	SET_ERROR_CODE
 	return NULL;
     }
-#ifdef _WIN32
-    PR_Sleep(PR_INTERVAL_NO_WAIT);     /* workaround NT winsock connect bug. */
-#endif
     ns = ssl_FindSocket(fd);
     PORT_Assert(ns);
     if (ns)
 	ns->TCPconnected = (PR_SUCCESS == ssl_DefGetpeername(ns, &addr));
     return fd;
 }
 
 PRFileDesc *
@@ -1986,19 +1983,16 @@ ssl_Connect(PRFileDesc *fd, const PRNetA
     }
 
     /* IF this is a listen socket, there shouldn't be any I/O going on */
     SSL_LOCK_READER(ss);
     SSL_LOCK_WRITER(ss);
 
     ss->cTimeout = timeout;
     rv = (PRStatus)(*ss->ops->connect)(ss, sockaddr);
-#ifdef _WIN32
-    PR_Sleep(PR_INTERVAL_NO_WAIT);     /* workaround NT winsock connect bug. */
-#endif
 
     SSL_UNLOCK_WRITER(ss);
     SSL_UNLOCK_READER(ss);
 
     return rv;
 }
 
 static PRStatus PR_CALLBACK