]> granicus.if.org Git - curl/commitdiff
CLOSESOCKETFUNCTION: use the callback
authorDaniel Stenberg <daniel@haxx.se>
Mon, 16 May 2011 21:52:15 +0000 (23:52 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 18 May 2011 20:56:46 +0000 (22:56 +0200)
Fix the return type of the callback to match close() and make use of it.

include/curl/curl.h
lib/connect.c

index e4fbfdf8951760ce612cd77f8316c13a33826dcb..a9d42fad69f41b2ba01bb1050e8640195918e013 100644 (file)
@@ -341,7 +341,7 @@ typedef curl_socket_t
                             curlsocktype purpose,
                             struct curl_sockaddr *address);
 
-typedef void
+typedef int
 (*curl_closesocket_callback)(void *clientp, curl_socket_t item);
 
 typedef enum {
index 2802c5d61d42ab170aadeb2fa4f5bce4b335c508..2dcf122c1b4e7f91849bfcef0a9e6b5bf65a25eb 100644 (file)
@@ -1172,7 +1172,8 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data,
 int Curl_closesocket(struct connectdata *conn,
                      curl_socket_t sock)
 {
-  (void)conn;
-
-  return sclose(sock);
+  if(conn && conn->fclosesocket)
+    return conn->fclosesocket(conn->closesocket_client, sock);
+  else
+    return sclose(sock);
 }