Bug 1259089 - Set TCP socket to non-blocking in sts again, just to be sure. r=mcmanus a=lizzard
☠☠ backed out by 2355485d9a8e ☠ ☠
authorDragana Damjanovic <dd.mozilla@gmail.com>
Wed, 06 Apr 2016 16:27:35 -0700
changeset 323820 d3d6344cc744aee65be009f5c23287ae9e1ab1c8
parent 323819 bceb0dcb8897b62191997048868272a836acdce1
child 323821 9e99383b97c614ba0927ee7d76e9e837b7ffba1f
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, lizzard
bugs1259089
milestone47.0a2
Bug 1259089 - Set TCP socket to non-blocking in sts again, just to be sure. r=mcmanus a=lizzard MozReview-Commit-ID: BnLuB9I7u1x
netwerk/base/nsSocketTransport2.cpp
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1414,16 +1414,29 @@ nsSocketTransport::InitiateSocket()
                 return NS_ERROR_FAILURE;
             }
             mBindAddr = nullptr;
         }
     }
 
     NetAddrToPRNetAddr(&mNetAddr, &prAddr);
 
+#ifdef XP_WIN
+    // Find the real tcp socket and set non-blocking once again!
+    PRFileDesc *bottom = PR_GetIdentitiesLayer(fd, PR_NSPR_IO_LAYER);
+    if (bottom) {
+      PROsfd osfd = PR_FileDesc2NativeHandle(bottom); 
+      uint32_t nonblocking = 1;
+      if (ioctlsocket(osfd, FIONBIO, &nonblocking) != 0) {
+        NS_WARNING("Socket could not be set non-blocking!");
+        return NS_ERROR_FAILURE;
+      }
+    }
+#endif
+
     // We use PRIntervalTime here because we need
     // nsIOService::LastOfflineStateChange time and
     // nsIOService::LastConectivityChange time to be atomic.
     PRIntervalTime connectStarted = 0;
     if (gSocketTransportService->IsTelemetryEnabled()) {
         connectStarted = PR_IntervalNow();
     }