cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Added callback on socket close

From: Christian Hägele <haegele_at_teamviewer.com>
Date: Tue, 24 May 2011 12:48:09 +0000 (UTC)

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

>
> I'm interested in feedback and comments. I've added two test cases that
verify
> the basic functionality and the options are documented:
>

First of all I am very happy that you implemented this feature, because I
always
thought when there is an OPENSOCKETFUNCTION there should also be a
CLOSESOCKETFUNCTION.

As I use the Multi-Interface an Windows in conjunction with boost::asio and
IOCP it is very crucial to exactly know when the socket is closed completly,
beacuse a socket can only be bound to a completion-port exactly once. This was
a problem in the current interface, because CURL_POLL_REMOVE didn't mean that
the socket won't be used any more, and because of that I couldn't free my
socket-wrapper-object.

I tested a nightly build from yesterday and adapted my application to the new
feature and noticed that the SOCKETFUNCTION for a specific socket was called
after the CLOSESOCKETFUNCTION for that socket was called. I assumed that this
should not happen, and after the CLOSESOCKETFUNCTION I can safley delete all
information about that socket.
I am not sure wheter it is some race-condition within my code or a flaw in
libcurl. I couldn't reproduce it 100% and because of that I can't provide
example-code right now. Maybe I will figure that out in the future.

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