cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Daniel Stenberg <daniel_at_haxx.se>
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
> _io_service.post(boost::bind(&http_client_async_handler::_poll_remove,
> 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.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-14