Bug 974785 - Fix -Wsometimes-uninitialized warning in nsHttpConnection.cpp. r=sworkman
authorChris Peterson <cpeterson@mozilla.com>
Wed, 19 Feb 2014 21:54:14 -0800
changeset 170171 1fbf700a1ba67d552b271bbeac13a24a7f61bbb5
parent 170170 d5114a4f905957fe237d5bef827eb66e9ce9bc0e
child 170172 a917689cc392eefa3a2accd9853da14ebacbb437
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssworkman
bugs974785
milestone30.0a1
Bug 974785 - Fix -Wsometimes-uninitialized warning in nsHttpConnection.cpp. r=sworkman
netwerk/protocol/http/nsHttpConnection.cpp
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -305,18 +305,16 @@ npnComplete:
     mNPNComplete = true;
     return true;
 }
 
 // called on the socket thread
 nsresult
 nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri)
 {
-    nsresult rv;
-
     MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnection::Activate [this=%p trans=%x caps=%x]\n",
          this, trans, caps));
 
     if (!trans->IsNullTransaction())
         mExperienced = true;
 
     mTransactionCaps = caps;
@@ -343,39 +341,38 @@ nsHttpConnection::Activate(nsAHttpTransa
     MOZ_ASSERT(!mIdleMonitoring, "Activating a connection with an Idle Monitor");
     mIdleMonitoring = false;
 
     // set mKeepAlive according to what will be requested
     mKeepAliveMask = mKeepAlive = (caps & NS_HTTP_ALLOW_KEEPALIVE);
 
     // need to handle HTTP CONNECT tunnels if this is the first time if
     // we are tunneling through a proxy
+    nsresult rv = NS_OK;
     if (mConnInfo->UsingConnect() && !mCompletedProxyConnect) {
         rv = SetupProxyConnect();
         if (NS_FAILED(rv))
             goto failed_activation;
         mProxyConnectInProgress = true;
     }
 
     // Clear the per activation counter
     mCurrentBytesRead = 0;
 
     // The overflow state is not needed between activations
     mInputOverflow = nullptr;
 
     mResponseTimeoutEnabled = mTransaction->ResponseTimeout() > 0 &&
                               mTransaction->ResponseTimeoutEnabled();
 
-    if (NS_SUCCEEDED(rv)) {
-        nsresult rv2 = StartShortLivedTCPKeepalives();
-        if (NS_WARN_IF(NS_FAILED(rv2))) {
-            LOG(("nsHttpConnection::Activate [%p] "
-                 "StartShortLivedTCPKeepalives failed rv2[0x%x]",
-                 this, rv2));
-        }
+    rv = StartShortLivedTCPKeepalives();
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+        LOG(("nsHttpConnection::Activate [%p] "
+             "StartShortLivedTCPKeepalives failed rv[0x%x]",
+             this, rv));
     }
 
     rv = OnOutputStreamReady(mSocketOut);
 
 failed_activation:
     if (NS_FAILED(rv)) {
         mTransaction = nullptr;
     }