]> granicus.if.org Git - curl/commit
multi: fix condition that remove timers before trigger
authorConstantine Sapuntzakis <csapuntz@gmail.com>
Mon, 12 Jul 2010 17:19:31 +0000 (19:19 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 12 Jul 2010 17:19:31 +0000 (19:19 +0200)
commitd4e64041352a4454dc0a961d125794692a913136
tree4fed8cce0d32737c3c5756174eca54778f892f18
parent3992309285cdb75076744aa8f9fb0f1cbd5dade5
multi: fix condition that remove timers before trigger

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 change does that.
lib/multi.c