From 4cded6deac83db7c41865b0c2234c33a76d2a089 Mon Sep 17 00:00:00 2001 From: Vladislavs Sokurenko Date: Fri, 22 Nov 2024 17:00:14 +0200 Subject: [PATCH] multi: fix callback for `CURLMOPT_TIMERFUNCTION` not being called again when... 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/multi.c b/lib/multi.c index 49fddc4720..1851dc731e 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -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) -- 2.47.3