bug 1094522 - only claim null transactions for your connection if KA eligible r=hurley CLOSED TREE
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 28 Jan 2015 16:56:57 -0500
changeset 239777 c4cccb7acc1b31de15c88cee68145b9776154893
parent 239776 eb6110f55c31093b490f4ef70112f06ba172b456
child 239778 1b4d065907781f033f6c74cce7fae9c0f070354d
push id506
push usermleibovic@mozilla.com
push dateThu, 29 Jan 2015 12:40:10 +0000
reviewershurley
bugs1094522
milestone38.0a1
bug 1094522 - only claim null transactions for your connection if KA eligible r=hurley CLOSED TREE
netwerk/protocol/http/nsHttpConnectionMgr.cpp
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -1495,25 +1495,29 @@ nsHttpConnectionMgr::MakeNewConnection(n
             }
 
             // return OK because we have essentially opened a new connection
             // by converting a speculative half-open to general use
             return NS_OK;
         }
     }
 
-    uint32_t activeLength = ent->mActiveConns.Length();
-    for (uint32_t i = 0; i < activeLength; i++) {
-        nsAHttpTransaction *activeTrans = ent->mActiveConns[i]->Transaction();
-        NullHttpTransaction *nullTrans = activeTrans ? activeTrans->QueryNullTransaction() : nullptr;
-        if (nullTrans && nullTrans->Claim()) {
-            LOG(("nsHttpConnectionMgr::MakeNewConnection [ci = %s] "
-                 "Claiming a null transaction for later use\n",
-                 ent->mConnInfo->HashKey().get()));
-            return NS_OK;
+    // consider null transactions that are being used to drive the ssl handshake if
+    // the transaction creating this connection can re-use persistent connections
+    if (trans->Caps() & NS_HTTP_ALLOW_KEEPALIVE) {
+        uint32_t activeLength = ent->mActiveConns.Length();
+        for (uint32_t i = 0; i < activeLength; i++) {
+            nsAHttpTransaction *activeTrans = ent->mActiveConns[i]->Transaction();
+            NullHttpTransaction *nullTrans = activeTrans ? activeTrans->QueryNullTransaction() : nullptr;
+            if (nullTrans && nullTrans->Claim()) {
+                LOG(("nsHttpConnectionMgr::MakeNewConnection [ci = %s] "
+                     "Claiming a null transaction for later use\n",
+                     ent->mConnInfo->HashKey().get()));
+                return NS_OK;
+            }
         }
     }
 
     // If this host is trying to negotiate a SPDY session right now,
     // don't create any new connections until the result of the
     // negotiation is known.
     if (!(trans->Caps() & NS_HTTP_DISALLOW_SPDY) &&
         (trans->Caps() & NS_HTTP_ALLOW_KEEPALIVE) &&