bug 1076129 generate event on socket transport cancelation r=sworkman
authorPatrick McManus <mcmanus@ducksong.com>
Thu, 02 Oct 2014 00:38:53 -0400
changeset 209948 896ed43b6b6128901455833025296f8a2ebc1d5c
parent 209907 f74ad36bb97b85909f7a3430288c07d3bf8b4e50
child 209949 dd859f1d5acc2a3a0dec82199ba90dd255339e43
push id27632
push userryanvm@gmail.com
push dateSat, 11 Oct 2014 20:21:25 +0000
treeherdermozilla-central@44168a7af20d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs1076129
milestone35.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 1076129 generate event on socket transport cancelation r=sworkman
netwerk/base/src/nsSocketTransport2.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -1230,17 +1230,19 @@ nsSocketTransport::InitiateSocket()
                 netAddrCString = NS_LITERAL_CSTRING("<IP-to-string failed>");
             SOCKET_LOG(("nsSocketTransport::InitiateSocket skipping "
                         "speculative connection for host [%s:%d] proxy "
                         "[%s:%d] with Local IP address [%s]",
                         mHost.get(), mPort, mProxyHost.get(), mProxyPort,
                         netAddrCString.get()));
         }
 #endif
-        return NS_ERROR_CONNECTION_REFUSED;
+        mCondition = NS_ERROR_CONNECTION_REFUSED;
+        OnSocketDetached(nullptr);
+        return mCondition;
     }
 
     //
     // find out if it is going to be ok to attach another socket to the STS.
     // if not then we have to wait for the STS to tell us that it is ok.
     // the notification is asynchronous, which means that when we could be
     // in a race to call AttachSocket once notified.  for this reason, when
     // we get notified, we just re-enter this function.  as a result, we are
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -1462,17 +1462,25 @@ nsHttpConnectionMgr::MakeNewConnection(n
             // We've found a speculative connection in the half
             // open list. Remove the speculative bit from it and that
             // connection can later be used for this transaction
             // (or another one in the pending queue) - we don't
             // need to open a new connection here.
             LOG(("nsHttpConnectionMgr::MakeNewConnection [ci = %s]\n"
                  "Found a speculative half open connection\n",
                  ent->mConnInfo->HashKey().get()));
+
+            uint32_t flags;
             ent->mHalfOpens[i]->SetSpeculative(false);
+            nsISocketTransport *transport = ent->mHalfOpens[i]->SocketTransport();
+            if (transport && NS_SUCCEEDED(transport->GetConnectionFlags(&flags))) {
+                flags &= ~nsISocketTransport::DISABLE_RFC1918;
+                transport->SetConnectionFlags(flags);
+            }
+
             Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_USED_SPECULATIVE_CONN> usedSpeculativeConn;
             ++usedSpeculativeConn;
 
             if (ent->mHalfOpens[i]->IsFromPredictor()) {
               Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_USED> totalPreconnectsUsed;
               ++totalPreconnectsUsed;
             }