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() ...@@ -217,15 +217,12 @@ CurlGlobal::ReadInfo()
} }
} }
int inline void
CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *userp) CurlGlobal::UpdateTimeout(long timeout_ms)
{ {
auto &global = *(CurlGlobal *)userp;
assert(_global == global.multi.Get());
if (timeout_ms < 0) { if (timeout_ms < 0) {
global.Cancel(); TimeoutMonitor::Cancel();
return 0; return;
} }
if (timeout_ms < 10) if (timeout_ms < 10)
...@@ -235,7 +232,16 @@ CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *user ...@@ -235,7 +232,16 @@ CurlGlobal::TimerFunction(gcc_unused CURLM *_global, long timeout_ms, void *user
of 10ms. */ of 10ms. */
timeout_ms = 10; 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; return 0;
} }
......
...@@ -76,6 +76,7 @@ public: ...@@ -76,6 +76,7 @@ public:
} }
private: private:
void UpdateTimeout(long timeout_ms);
static int TimerFunction(CURLM *global, long timeout_ms, void *userp); static int TimerFunction(CURLM *global, long timeout_ms, void *userp);
/* virtual methods from class TimeoutMonitor */ /* 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