From 60f0ebbdc9fbddccaa4e2fcd1dce3d3a05f234ed Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 16 May 2011 23:52:15 +0200 Subject: CLOSESOCKETFUNCTION: use the callback Fix the return type of the callback to match close() and make use of it. --- include/curl/curl.h | 2 +- lib/connect.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index e4fbfdf89..a9d42fad6 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -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 { diff --git a/lib/connect.c b/lib/connect.c index 2802c5d61..2dcf122c1 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -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); } -- cgit v1.2.3