cURL / Mailing Lists / curl-library / Single Mail


Re: Added callback on socket close

From: Daniel Stenberg <>
Date: Wed, 25 May 2011 19:39:58 +0200 (CEST)

On Tue, 24 May 2011, Christian Hägele wrote:

> 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

I'm glad you find it useful!

> 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.

That doesn't surprise me at all, since the logic that detects that a socket is
no longer used and calls the SOCKETFUNCTION is totally separate from the
CLOSESOCKETFUNCTION callback logic and is often called after the actual socket
has been closed.

I'm not prepared to make any guarantees right now in which order those two
callbacks will be called as that would require more work and added tests and I
don't feel like doing that job now.


List admin:
Received on 2011-05-25