Bug 1338086 - Remove useless else blocks in order to reduce complexity testing/mochitest/ssltunnel/ r?jmaher draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 09 Feb 2017 10:53:11 +0100
changeset 484418 0a132818df453e63b0c547df1b952c36ad5f48db
parent 484417 63cd85675e8bbd936c36a670149c2b33fb3e9d85
child 484419 0da15e380a8ff298d753621d5795ae85cb0761d2
push id45470
push userbmo:sledru@mozilla.com
push dateWed, 15 Feb 2017 08:57:47 +0000
reviewersjmaher
bugs1338086
milestone54.0a1
Bug 1338086 - Remove useless else blocks in order to reduce complexity testing/mochitest/ssltunnel/ r?jmaher MozReview-Commit-ID: sbiCAKDekh
testing/mochitest/ssltunnel/ssltunnel.cpp
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -235,18 +235,18 @@ bool any_host_spec_config = false;
 int ClientAuthValueComparator(const void *v1, const void *v2)
 {
   int a = *static_cast<const client_auth_option*>(v1) -
           *static_cast<const client_auth_option*>(v2);
   if (a == 0)
     return 0;
   if (a > 0)
     return 1;
-  else // (a < 0)
-    return -1;
+  // (a < 0)
+  return -1;
 }
 
 static int match_hostname(PLHashEntry *he, int index, void* arg)
 {
   server_match_t *match = (server_match_t*)arg;
   if (match->fullHost.find((char*)he->key) != string::npos)
     match->matched = true;
   return HT_ENUMERATE_NEXT;
@@ -829,40 +829,37 @@ void HandleConnection(void* data)
             {
               // Do not poll for read when the buffer is full
               LOG_DEBUG((" no place in our read buffer, stop reading"));
               in_flags &= ~PR_POLL_READ;
             }
 
             if (ssl_updated)
             {
-              if (s == 0 && expect_request_start) 
+              if (s == 0 && expect_request_start)
               {
                 if (!strstr(buffers[s].bufferhead, "\r\n\r\n"))
                 {
                   // We haven't received the complete header yet, so wait.
                   continue;
                 }
-                else
+                ci->iswebsocket = AdjustWebSocketHost(buffers[s], ci);
+                expect_request_start = !(ci->iswebsocket ||
+                                         AdjustRequestURI(buffers[s], &fullHost));
+                PRNetAddr* addr = &remote_addr;
+                if (ci->iswebsocket && websocket_server.inet.port)
+                  addr = &websocket_server;
+                if (!ConnectSocket(other_sock, addr, connect_timeout))
                 {
-                  ci->iswebsocket = AdjustWebSocketHost(buffers[s], ci);
-                  expect_request_start = !(ci->iswebsocket || 
-                                           AdjustRequestURI(buffers[s], &fullHost));
-                  PRNetAddr* addr = &remote_addr;
-                  if (ci->iswebsocket && websocket_server.inet.port)
-                    addr = &websocket_server;
-                  if (!ConnectSocket(other_sock, addr, connect_timeout))
-                  {
-                    LOG_ERRORD((" could not open connection to the real server\n"));
-                    client_error = true;
-                    break;
-                  }
-                  LOG_DEBUG(("\n connected to remote server\n"));
-                  numberOfSockets = 2;
+                  LOG_ERRORD((" could not open connection to the real server\n"));
+                  client_error = true;
+                  break;
                 }
+                LOG_DEBUG(("\n connected to remote server\n"));
+                numberOfSockets = 2;
               }
               else if (s == 1 && ci->iswebsocket)
               {
                 if (!AdjustWebSocketLocation(buffers[s], ci))
                   continue;
               }
 
               in_flags2 |= PR_POLL_WRITE;