cURL / Mailing Lists / curl-library / Single Mail


Re: Added callback on socket close

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

Daniel Stenberg <daniel <at>> writes:

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

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

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

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:
Received on 2011-05-24