From 161afb3eaeafa6dc4e8af021d6696ece87e89a26 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Thu, 16 Feb 2017 06:50:00 -0500 Subject: [PATCH] Bug 1326136 - Let nsHttpConnection close it's transaction on shutdown. r=mcmanus --HG-- extra : rebase_source : 64ace3aba1174b82d74d3b872395dcc9e44c8a12 --- netwerk/protocol/http/nsHttpConnection.cpp | 5 +++-- netwerk/protocol/http/nsHttpConnection.h | 2 +- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index 75903b3fdbc4..0664fa59d881 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -1594,7 +1594,8 @@ nsHttpConnection::Version() //----------------------------------------------------------------------------- void -nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) +nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason, + bool aIsShutdown) { LOG(("nsHttpConnection::CloseTransaction[this=%p trans=%p reason=%x]\n", this, trans, reason)); @@ -1630,7 +1631,7 @@ nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) } if (NS_FAILED(reason) && (reason != NS_BINDING_RETARGETED)) { - Close(reason); + Close(reason, aIsShutdown); } // flag the connection as reused here for convenience sake. certainly diff --git a/netwerk/protocol/http/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h index 3f9e63abb3b1..783b080b3249 100644 --- a/netwerk/protocol/http/nsHttpConnection.h +++ b/netwerk/protocol/http/nsHttpConnection.h @@ -128,7 +128,7 @@ public: // nsAHttpConnection compatible methods (non-virtual): nsresult OnHeadersAvailable(nsAHttpTransaction *, nsHttpRequestHead *, nsHttpResponseHead *, bool *reset); - void CloseTransaction(nsAHttpTransaction *, nsresult reason); + void CloseTransaction(nsAHttpTransaction *, nsresult reason, bool aIsShutdown = false); void GetConnectionInfo(nsHttpConnectionInfo **ci) { NS_IF_ADDREF(*ci = mConnInfo); } nsresult TakeTransport(nsISocketTransport **, nsIAsyncInputStream **, diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index a0c3f9beb719..42fc9371faa0 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -2145,7 +2145,10 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, ARefBase *param) RefPtr conn(ent->mActiveConns[0]); ent->mActiveConns.RemoveElementAt(0); DecrementActiveConnCount(conn); - conn->Close(NS_ERROR_ABORT, true); + // Since nsHttpConnection::Close doesn't break the bond with + // the connection's transaction, we must explicitely tell it + // to close its transaction and not just self. + conn->CloseTransaction(conn->Transaction(), NS_ERROR_ABORT, true); } // Close all idle connections.