bug 1076129 generate event on socket transport cancelation r=sworkman
☠☠ backed out by 759811d71d32 ☠ ☠
authorPatrick McManus <mcmanus@ducksong.com>
Thu, 02 Oct 2014 00:47:28 -0400
changeset 208788 77c1b79c5becae13b1e83b871bf3727f0cf4fced
parent 208787 382cc6a75564a3a736e5895af5fa94d3986cfcd6
child 208789 8e947d1636f10aa16abfe578f96405325dda730c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssworkman
bugs1076129
milestone35.0a1
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
@@ -1234,17 +1234,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 (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;
             }