cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: OPENSOCKETFUNCTION hook not called for all socket creations on Windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 14 Dec 2011 16:23:18 +0100 (CET)

On Wed, 14 Dec 2011, Christian Hägele wrote:

>> Hi, on Windows, libcurl does not seem to honor the CURLOPT_OPENSOCKETFUNCTION
>> hook for the 'dummy_sock' socket created in init_resolve_thread() function.

> I had the same issue reported earlier.(http://thread.gmane.org/
> gmane.comp.web.curl.library/33280)
>
> I am using boost::asio to manage the sockets and events on the sockets. My
> workaround for this issue is to keep track of all sockets I opened myself
> via the CURLOPT_OPENSOCKETFUNCTION and if CURLMOPT_SOCKETFUNCTION gets
> called with a unknown socket I just ignore it.

This is probably to be considered a bug. I'll appreciate a patch!

> It is possible that CURLOPT_CLOSESOCKETFUNCTION gets called and after that
> the CURLMOPT_SOCKETFUNCTION gets called with the socket you closed just
> before and the CURL_POLL_REMOVE action is set.

Yes, this is probably even the order in which these events happen most of the
times. I think this is primarily a matter of improving the documentation to
make it become less surprising.

-- 
  / daniel.haxx.se

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