Commit 9f5eddcd authored by Max Kellermann's avatar Max Kellermann

lib/curl/Global: move code to UpdateTimeout()

parent 3cba7655
......@@ -217,15 +217,12 @@ CurlGlobal::ReadInfo()
}
}
int
CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *userp)
inline void
CurlGlobal::UpdateTimeout(long timeout_ms)
{
auto &global = *(CurlGlobal *)userp;
assert(_global == global.multi.Get());
if (timeout_ms < 0) {
global.Cancel();
return 0;
TimeoutMonitor::Cancel();
return;
}
if (timeout_ms < 10)
......@@ -235,7 +232,16 @@ CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *user
of 10ms. */
timeout_ms = 10;
global.Schedule(std::chrono::milliseconds(timeout_ms));
TimeoutMonitor::Schedule(std::chrono::milliseconds(timeout_ms));
}
int
CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *userp)
{
auto &global = *(CurlGlobal *)userp;
assert(_global == global.multi.Get());
global.UpdateTimeout(timeout_ms);
return 0;
}
......
......@@ -76,6 +76,7 @@ public:
}
private:
void UpdateTimeout(long timeout_ms);
static int TimerFunction(CURLM *global, long timeout_ms, void *userp);
/* virtual methods from class TimeoutMonitor */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment