multi:SetOpt_TimerFunction(timer_callback[, userdata])
Certain features, such as timeouts and retries, require you to call libcurl even when there is no activity on the file descriptors.
Your callback function will receive a single parameter called timeout_ms
.
If you pass the optional userdata
argument, the value you pass in userdata
will be passed to your callback function as a second parameter. The userdata
parameter can be of any type
Once called, your callback function should install a non-repeating
timer with an interval of timeout_ms
. Each time that timer fires, call
either multi:SocketAction() or multi:Perform()
depending on which interface you use.
A timeout_ms
value of -1 means you should delete your timer.
A timeout_ms
value of 0 means you should call
multi:SocketAction() or multi:Perform() (once) as soon
as possible.
The timer callback will only be called when the timeout_ms
changes.
The timer callback should return 0 on success, and -1 on error. This callback can be used instead of, or in addition to, multi:Timeout().