bug 667387 - make nshttppipeline::taketransport() work with websockets r=honzab
authorPatrick McManus <mcmanus@ducksong.com>
Fri, 06 Jan 2012 08:46:15 -0500
changeset 85162 6b1628d598550d6a8d38f922f6fefeeef7a13eba
parent 85161 fa8c8e768e9fc0a08eb882864e06e99a4ad82dd6
child 85163 8522883040c0afc619cd05161d9b36c439136cb2
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs667387
milestone12.0a1
bug 667387 - make nshttppipeline::taketransport() work with websockets r=honzab
netwerk/protocol/http/nsHttpPipeline.cpp
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -108,29 +108,31 @@ nsHttpPipeline::nsHttpPipeline()
 {
 }
 
 nsHttpPipeline::~nsHttpPipeline()
 {
     // make sure we aren't still holding onto any transactions!
     Close(NS_ERROR_ABORT);
 
+    NS_IF_RELEASE(mConnection);
+
     if (mPushBackBuf)
         free(mPushBackBuf);
 }
 
 nsresult
 nsHttpPipeline::AddTransaction(nsAHttpTransaction *trans)
 {
     LOG(("nsHttpPipeline::AddTransaction [this=%x trans=%x]\n", this, trans));
 
     NS_ADDREF(trans);
     mRequestQ.AppendElement(trans);
 
-    if (mConnection) {
+    if (mConnection && !mClosed) {
         trans->SetConnection(this);
 
         if (mRequestQ.Length() == 1)
             mConnection->ResumeSend(trans);
     }
 
     return NS_OK;
 }
@@ -695,20 +697,16 @@ nsHttpPipeline::Close(nsresult reason)
         for (i=1; i<count; ++i) {
             trans = Response(i);
             trans->Close(NS_ERROR_NET_RESET);
             NS_RELEASE(trans);
         }
         mResponseQ.Clear();
     }
 
-    // we must no longer reference the connection!  This needs to come
-    // after we've closed all our transactions, since they might want
-    // connection info as they close.
-    NS_IF_RELEASE(mConnection);
 }
 
 nsresult
 nsHttpPipeline::OnReadSegment(const char *segment,
                               PRUint32 count,
                               PRUint32 *countRead)
 {
     return mSendBufOut->Write(segment, count, countRead);