]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: move retrycount from connect struct to easy handle
authorStefan Yohansson <sy.fen0@gmail.com>
Mon, 10 Aug 2020 12:16:37 +0000 (13:16 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 10 Aug 2020 21:20:17 +0000 (23:20 +0200)
This flag was applied to the connection struct that is released on
retry.  These changes move the retry counter into Curl_easy struct that
lives across retries and retains the new connection.

Reported-by: Cherish98 on github
Fixes #5794
Closes #5800

lib/transfer.c
lib/urldata.h

index 161dcfa01c1a618469039f54cc1afa9346c3a67e..a07c7af8cec64f7bbb1fc4a83c9392ec3f8a5344 100644 (file)
@@ -1804,12 +1804,14 @@ CURLcode Curl_retry_request(struct connectdata *conn,
   }
   if(retry) {
 #define CONN_MAX_RETRIES 5
-    if(conn->retrycount++ >= CONN_MAX_RETRIES) {
+    if(data->state.retrycount++ >= CONN_MAX_RETRIES) {
       failf(data, "Connection died, tried %d times before giving up",
             CONN_MAX_RETRIES);
+      data->state.retrycount = 0;
       return CURLE_SEND_ERROR;
     }
-    infof(conn->data, "Connection died, retrying a fresh connect\n");
+    infof(conn->data, "Connection died, retrying a fresh connect\
+(retry count: %d)\n", data->state.retrycount);
     *url = strdup(conn->data->change.url);
     if(!*url)
       return CURLE_OUT_OF_MEMORY;
index 332ffb39290c77ca2fa504151e4fa1c252e485c2..8ddb580c8965358ecfe3f7219cef111493e54d48 100644 (file)
@@ -1090,7 +1090,6 @@ struct connectdata {
   struct http_connect_state *connect_state; /* for HTTP CONNECT */
   struct connectbundle *bundle; /* The bundle we are member of */
   int negnpn; /* APLN or NPN TLS negotiated protocol, CURL_HTTP_VERSION* */
-  int retrycount; /* number of retries on a new connection */
 #ifdef USE_UNIX_SOCKETS
   char *unix_domain_socket;
 #endif
@@ -1296,6 +1295,8 @@ struct UrlState {
   /* Points to the connection cache */
   struct conncache *conn_cache;
 
+  int retrycount; /* number of retries on a new connection */
+
   /* buffers to store authentication data in, as parsed from input options */
   struct curltime keeps_speed; /* for the progress meter really */