cURL / Mailing Lists / curl-library / Single Mail

curl-library

possible bug when using socket close callback?

From: Frank Meier <frank.meier_at_ergon.ch>
Date: Tue, 24 Feb 2015 11:53:58 +0100

Hi

I just stumbled over some libcurl code, that seems strange to me: in
function Curl_closesocket() in connect.c the call to Curl_multi_closed()
is omitted if a socket close function (CURLOPT_CLOSESOCKETFUNCTION) is
registered.
My understanding is that the behavior if a registered callback only
calls close() on the given socket should be the same as if no callback
was used.
I havent tested anything, it just caught my eye. So could this be a problem?

so I would propose something like:

  --- a/lib/connect.c
+++ b/lib/connect.c
@@ -1266,6 +1266,7 @@ int Curl_closesocket(struct connectdata *conn,
           status */
        conn->sock_accepted[SECONDARYSOCKET] = FALSE;
      else
+ Curl_multi_closed(conn, sock);
        return conn->fclosesocket(conn->closesocket_client, sock);
    }

cheers, Frank

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