CLOSESOCKETFUNCTION: added

Introduced the initial setup to allow closesocket callbacks by making
sure sclose() is only ever called from one place in the libcurl source
and still run all test cases fine.
This commit is contained in:
Daniel Stenberg 2011-05-16 23:46:43 +02:00
parent d4e000906a
commit b5d170b551
10 changed files with 71 additions and 25 deletions

View file

@ -341,6 +341,9 @@ typedef curl_socket_t
curlsocktype purpose,
struct curl_sockaddr *address);
typedef void
(*curl_closesocket_callback)(void *clientp, curl_socket_t item);
typedef enum {
CURLIOE_OK, /* I/O operation successful */
CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
@ -1475,6 +1478,11 @@ typedef enum {
*/
CINIT(TRANSFER_ENCODING, LONG, 207),
/* Callback function for closing socket (instead of close(2)). The callback
should have type curl_closesocket_callback */
CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;