diff options
author | Gokhan Sengun <gokhansengun@gmail.com> | 2011-12-07 16:00:20 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-12-07 16:03:00 +0100 |
commit | 1cacf853da30edb8a9f6b834df43ee639a1811f2 (patch) | |
tree | 3103fe4208870cbe2a8816b641ed4ddbf4c81330 | |
parent | 9dbe6565d49c1959530daf97bbb3062a611e18af (diff) |
Curl_closesocket: clear sock_accepted on close
As a follow-up from commit d5b5f64bce3a8, clear the sock_accepted status
when such a socket is closed to avoid a re-used connection to retain the
state wrongly.
Bug: http://curl.haxx.se/mail/lib-2011-12/0079.html
-rw-r--r-- | lib/connect.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/connect.c b/lib/connect.c index a560c4d3b..af225ab83 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1111,10 +1111,13 @@ int Curl_closesocket(struct connectdata *conn, curl_socket_t sock) { if(conn && conn->fclosesocket) { - if((sock != conn->sock[SECONDARYSOCKET]) || - !conn->sock_accepted[SECONDARYSOCKET]) + if((sock == conn->sock[SECONDARYSOCKET]) && + conn->sock_accepted[SECONDARYSOCKET]) /* if this socket matches the second socket, and that was created with - accept, then we MUST NOT call the callback */ + accept, then we MUST NOT call the callback but clear the accepted + status */ + conn->sock_accepted[SECONDARYSOCKET] = FALSE; + else return conn->fclosesocket(conn->closesocket_client, sock); } return sclose(sock); |