From 1366b6fd6181fa60d5d842cbab1f5dbce586afbb Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Wed, 30 Apr 2014 13:15:46 -0400 Subject: [PATCH] bug 1003935 - call dontreuse() on reclaimed conns with transaction refs r=sworkman --- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 7 +++++++ netwerk/protocol/http/nsHttpTransaction.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index b414f80b4a2b..9ad868a06491 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -2366,6 +2366,13 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) ConditionallyStopTimeoutTick(); } + // a connection that still holds a reference to a transaction was + // not closed naturally (i.e. it was reset or aborted) and is + // therefore not something that should be reused. + if (conn->Transaction()) { + conn->DontReuse(); + } + if (conn->CanReuse()) { LOG((" adding connection to idle list\n")); // Keep The idle connection list sorted with the connections that diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 6867c0569b96..190558bd3257 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -1066,7 +1066,10 @@ nsHttpTransaction::Restart() // clear old connection state... mSecurityInfo = 0; - NS_IF_RELEASE(mConnection); + if (mConnection) { + mConnection->DontReuse(); + NS_RELEASE(mConnection); + } // disable pipelining for the next attempt in case pipelining caused the // reset. this is being overly cautious since we don't know if pipelining