cURL / Mailing Lists / curl-library / Single Mail


Re: correct usage of curl_multi_setopt(_multi, CURLMOPT_SOCKETFUNCTION, _sock_cb); / curl_multi_remove_handle / curl_easy_cleanup

From: Daniel Stenberg <>
Date: Tue, 14 Jan 2014 10:43:44 +0100 (CET)

On Tue, 14 Jan 2014, svante karlsson wrote:

> Yep, that was it.
> Since I'm using asio I moved the cleanup calls (A + B) to a separate
> function and called this using
> this, context));
> which means that it will be called after the current callback has ended.

Just don't remove/close any handle because a file descriptor is removed. A
handle can use no, one or more file descriptors (and it can certainly change
them through its life time) and you should keep the file descriptor "attached"
to the multi handle until it reports as completed - at least if you want to
perform the complete transfer.

List admin:
Received on 2014-01-14