cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] code cleanup: Remove superfluous for loop.

From: Björn Stenberg <bjst_at_bjorn>
Date: Tue, 5 Nov 2013 23:57:22 +0100

The reason for this loop's existence was removed in the Happy Eyeballs
patch.

---
 lib/url.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index b069375..9526cdc 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -5559,25 +5559,19 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
      is later set again for the progress meter purpose */
   conn->now = Curl_tvnow();
 
-  for(;;) {
-    /* loop for CURL_SERVER_CLOSED_CONNECTION */
-
-    if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
-      conn->bits.tcpconnect[FIRSTSOCKET] = FALSE;
-      result = Curl_connecthost(conn, conn->dns_entry);
-      if(CURLE_OK != result)
-        return result;
-    }
-    else {
-      Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
-      Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
-      conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;
-      *protocol_done = TRUE;
-      Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]);
-      Curl_verboseconnect(conn);
-    }
-    /* Stop the loop now */
-    break;
+  if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
+    conn->bits.tcpconnect[FIRSTSOCKET] = FALSE;
+    result = Curl_connecthost(conn, conn->dns_entry);
+    if(CURLE_OK != result)
+      return result;
+  }
+  else {
+    Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
+    Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
+    conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;
+    *protocol_done = TRUE;
+    Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]);
+    Curl_verboseconnect(conn);
   }
 
   conn->now = Curl_tvnow(); /* time this *after* the connect is done, we
-- 
1.8.4.rc3
--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
--uAKRQypu60I7Lcqm--
Received on 2001-09-17