From: Vladislavs Sokurenko Date: Fri, 22 Nov 2024 15:00:14 +0000 (+0200) Subject: multi: fix callback for `CURLMOPT_TIMERFUNCTION` not being called again when... X-Git-Tag: curl-8_11_1~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4cded6deac83db7c41865b0c2234c33a76d2a089;p=thirdparty%2Fcurl.git 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 --- 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)