Bug 1362978 - Remove callbacks on socketInput stream if we cancel a TFO socketTransport. r=mcmanus
authorDragana Damjanovic <dd.mozilla@gmail.com>
Wed, 10 May 2017 22:54:27 +0200
changeset 357708 34a781e4f023a78e02a3c08544e9cb72382b644f
parent 357707 fa38c52a84a53685883ea4040193ea5c38c6ff8f
child 357709 f4aa943a5bc9edffdca2f7585040aac8e1d2b44d
push id31800
push userarchaeopteryx@coole-files.de
push dateThu, 11 May 2017 14:51:27 +0000
treeherdermozilla-central@0259418f19ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1362978
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1362978 - Remove callbacks on socketInput stream if we cancel a TFO socketTransport. r=mcmanus
netwerk/protocol/http/nsHttpConnection.cpp
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1460,28 +1460,35 @@ nsHttpConnection::ResumeSend()
 
 nsresult
 nsHttpConnection::ResumeRecv()
 {
     LOG(("nsHttpConnection::ResumeRecv [this=%p]\n", this));
 
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
+    if (mFastOpen) {
+        LOG(("nsHttpConnection::ResumeRecv - do not waiting for read during "
+             "fast open! [this=%p]\n", this));
+        return NS_OK;
+    }
+
     // mResponseThrottled is an indication from above layers to stop reading
     // the socket.
     if (mResponseThrottled) {
         mResumeRecvOnUnthrottle = true;
 
         if (mSocketIn) {
             LOG(("  throttled, waiting for closure only"));
             return mSocketIn->AsyncWait(this,
                                         nsIAsyncInputStream::WAIT_CLOSURE_ONLY,
                                         0, nullptr);
         }
         LOG(("  throttled, and no socket input stream"));
+        NS_NOTREACHED("no socket input stream");
         return NS_OK;
     }
 
     // the mLastReadTime timestamp is used for finding slowish readers
     // and can be pretty sensitive. For that reason we actually reset it
     // when we ask to read (resume recv()) so that when we get called back
     // with actual read data in OnSocketReadable() we are only measuring
     // the latency between those two acts and not all the processing that
@@ -2369,16 +2376,20 @@ nsHttpConnection::CloseConnectionFastOpe
         mTransaction->SetConnection(nullptr);
     }
 
     {
         MutexAutoLock lock(mCallbacksLock);
         mCallbacks = nullptr;
     }
 
+    if (mSocketIn) {
+        mSocketIn->AsyncWait(nullptr, 0, 0, nullptr);
+    }
+
     mTransaction = nullptr;
     if (!aCloseSocketTransport) {
         if (mSocketOut) {
             mSocketOut->AsyncWait(nullptr, 0, 0, nullptr);
         }
         mSocketTransport->SetEventSink(nullptr, nullptr);
         mSocketTransport->SetSecurityCallbacks(nullptr);
         mSocketTransport = nullptr;