cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Christian Hägele <haegele_at_teamviewer.com>
Date: Wed, 28 Dec 2011 13:39:01 +0100

Daniel Stenberg <daniel <at> haxx.se> writes:

>I've written up a patch for this problem. See the attached file.
>I don't have or develop on Windows so I haven't been able to actually
> test oreven build this code to verify that it actually works as
> intended. Let me knowhow it works and what furthre tweaks we need to do!
>

Hello,

I tested your patch (against current curl-7.23.1) and found two minor
issues in
asyn-thread.c. I have attached a patch with my corrections.
The patch works as intended. As it changes the public API (new value
CURLSOCKTYPE_DUMMY) there might be issues with existing applications,
though.
(No big deal. Properly written applications should be fine)

Overall the change clarifies that the socket is a dummy-socket because of
the new
value in the OPENSOCKETFUNCTION. But as it is still a dummy-socket for a
windows-only workaround. There might be some better way to do it.
There are other dummy-sockets in curl which are not propagated to the
caller at
all (e.g. when checking for IPv6-support). A direct call to socket-syscall
is
made on the socket is closed right after usage.

I think a similar approach for the dummy-socket in asyn-thread.c would be a
better solution. That would make the code easier and the change-set
smaller.
The only reason for the dummy socket is to have one socket in the
Curl_resolver_getsock() call. The better solution would be to work with the
situation that Curl_resolver_getsock() returns no sockets. (Which it does
on
non-windows platforms)

Regards,

Christian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2011-12-28