Bug 1338086 - Remove useless else blocks in order to reduce complexity testing/mochitest/ssltunnel/ r?jmaher
MozReview-Commit-ID: sbiCAKDekh
--- 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;