Backout 73512caf4647 (bug 692260) for Ts regression.
authorMarco Bonardo <mbonardo@mozilla.com>
Sat, 22 Oct 2011 09:32:54 +0200
changeset 79115 01d0d7a3e4f7017d77f5500f88fe2884e8c1f502
parent 79114 baea99de141d00907525deb08a40f23c4f95b0be
child 79116 d252e090c6cfd751b2744ecc03da056ca738f2a4
push id247
push usertim.taubert@gmx.de
push dateSat, 22 Oct 2011 19:08:15 +0000
treeherderfx-team@72bb20c484a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs692260
milestone10.0a1
backs out73512caf4647f79b7c0d019ca11e390bac61b424
Backout 73512caf4647 (bug 692260) for Ts regression.
netwerk/base/src/nsSocketTransportService2.cpp
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -876,71 +876,17 @@ nsSocketTransportService::DiscoverMaxCou
     // use the historical 50 in every case older than XP (0x501).
     // >= XP is confirmed to have at least 1000
 
     OSVERSIONINFO osInfo = { sizeof(OSVERSIONINFO) };
     if (GetVersionEx(&osInfo)) {
         PRInt32 version = 
             (osInfo.dwMajorVersion & 0xff) << 8 | 
             (osInfo.dwMinorVersion & 0xff);
-        if (version >= 0x501) {                    /* xp or later */
+        if (version >= 0x501)                    /* xp or later */
             gMaxCount = SOCKET_LIMIT_TARGET;
-
-            // Allocate and test a PR_Poll up to the gMaxCount number of unconnected
-            // sockets. See bug 692260 - windows should be able to handle 1000 sockets
-            // in select() without a problem, but LSPs have been known to balk at lower
-            // numbers. (64 in the bug).
-
-            // Allocate
-            struct PRPollDesc pfd[SOCKET_LIMIT_TARGET];
-            PRUint32 numAllocated = 0;
-
-            for (PRUint32 index = 0 ; index < gMaxCount; ++index) {
-                pfd[index].in_flags = PR_POLL_READ | PR_POLL_WRITE | PR_POLL_EXCEPT;
-                pfd[index].out_flags = 0;
-                pfd[index].fd =  PR_OpenTCPSocket(PR_AF_INET);
-                if (!pfd[index].fd) {
-                    SOCKET_LOG(("Socket Limit Test index %d failed\n", index));
-                    if (index < SOCKET_LIMIT_MIN)
-                        gMaxCount = SOCKET_LIMIT_MIN;
-                    else
-                        gMaxCount = index;
-                    break;
-                }
-                ++numAllocated;
-            }
-
-            // Test
-            NS_ABORT_IF_FALSE(SOCKET_LIMIT_MIN >= 32U,
-                              "#defined socket_limit_min risks underflow");
-            while (gMaxCount <= numAllocated) {
-                PRInt32 rv = PR_Poll(pfd, gMaxCount, PR_MillisecondsToInterval(0));
-
-                SOCKET_LOG(("Socket Limit Test poll() size=%d rv=%d\n",
-                            gMaxCount, rv));
-
-                if (rv >= 0)
-                    break;
-
-                SOCKET_LOG(("Socket Limit Test poll confirmationSize=%d rv=%d error=%d\n",
-                            gMaxCount, rv, PR_GetError()));
-
-                gMaxCount -= 32;
-                if (gMaxCount <= SOCKET_LIMIT_MIN) {
-                    gMaxCount = SOCKET_LIMIT_MIN;
-                    break;
-                }
-            }
-
-            // Free
-            for (PRUint32 index = 0 ; index < numAllocated; ++index)
-                if (pfd[index].fd)
-                    PR_Close(pfd[index].fd);
-
-            SOCKET_LOG(("Socket Limit Test max was confirmed at %d\n", gMaxCount));
-        }
     }
 #else
     // other platforms are harder to test - so leave at safe legacy value
 #endif
 
     return PR_SUCCESS;
 }
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -834,27 +834,19 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
         rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
         if (NS_SUCCEEDED(rv)) {
             PR_CallOnce(&nsSocketTransportService::gMaxCountInitOnce,
                         nsSocketTransportService::DiscoverMaxCount);
-            // Don't use the full max count because sockets can be held in
-            // the persistent connection pool for a long time and that could
-            // starve other users.
-
-            PRUint32 maxCount = nsSocketTransportService::gMaxCount;
-            if (maxCount <= 8)
-                maxCount = 1;
-            else
-                maxCount -= 8;
-            mMaxConnections = (PRUint16) NS_CLAMP((PRUint32)val, 1, maxCount);
-
+            mMaxConnections =
+                (PRUint16) NS_CLAMP((PRUint32)val, 1,
+                                    nsSocketTransportService::gMaxCount);
             if (mConnMgr)
                 mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS,
                                       mMaxConnections);
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("max-connections-per-server"))) {
         rv = prefs->GetIntPref(HTTP_PREF("max-connections-per-server"), &val);