cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] curl_multi_perform and timers

From: Constantine Sapuntzakis <csapuntz_at_gmail.com>
Date: Thu, 8 Jul 2010 19:48:01 -0700

curl_multi perform has two phases: run through every easy handle
calling multi_runsingle and remove expired timers (timer removal).

If a small timer (e.g. 1-10ms) is set during multi_runsingle, then
it's possible that the timer has passed by when the timer removal
runs. The timer which was just added is then removed. This will
potentially cause the timer list to be empty and cause the next call
to curl_multi_timeout to return -1. Ideally, curl_multi_timeout should
return 0 in this case.

One way to fix this is to move the struct timeval now = Curl_tvnow();
to the top of curl_multi_perform. The patch attached does that.

-Costa

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2010-07-09