bug 1094522 - only claim null transactions for your connection if KA eligible r=hurley CLOSED TREE
--- 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) &&