]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: fix callback for `CURLMOPT_TIMERFUNCTION` not being called again when...
authorVladislavs Sokurenko <vladislavs.sokurenko@gmail.com>
Fri, 22 Nov 2024 15:00:14 +0000 (17:00 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 25 Nov 2024 17:36:42 +0000 (18:36 +0100)
Issue is reproducible for me if I have made request with multi handle,
then I make request that will take very long and then I make request
that should be fast again, however what happens it is that it seems
to think that timeout was not changed and it makes it not call initial
`CURLMOPT_TIMERFUNCTION`.

Closes #15627

lib/multi.c

index 49fddc47203878cbadc6f92c2f5f9b234cf510a2..1851dc731e657eb13b406d05b38cbbc8cc50d81b 100644 (file)
@@ -3589,6 +3589,14 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
       }
     }
   }
+  else {
+    /* Asked to run due to time-out. Clear the 'last_expire_ts' variable to
+       force Curl_update_timer() to trigger a callback to the app again even
+       if the same timeout is still the one to run after this call. That
+       handles the case when the application asks libcurl to run the timeout
+       prematurely. */
+    memset(&multi->last_expire_ts, 0, sizeof(multi->last_expire_ts));
+  }
 
   result = multi_run_expired(&mrc);
   if(result)