aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorJon Spencer <jon@jonspencer.ca>2014-11-14 10:32:47 -0800
committerDaniel Stenberg <daniel@haxx.se>2014-11-19 13:22:07 +0100
commit29336986772dd4262ca85e8ef0120d3cbdf10a23 (patch)
treee2b13448f24be4a9e70db33b38e15edb631da440 /lib/connect.c
parentcf510ad7817d33a0d6730f39e05e277dc23a9966 (diff)
multi: inform about closed sockets before they are closed
When the connection code decides to close a socket it informs the multi system via the Curl_multi_closed function. The multi system may, in turn, invoke the CURLMOPT_SOCKETFUNCTION function with CURL_POLL_REMOVE. This happens after the socket has already been closed. Reorder the code so that CURL_POLL_REMOVE is called before the socket is closed.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 5f64afab3..3be491895 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1244,12 +1244,13 @@ int Curl_closesocket(struct connectdata *conn,
else
return conn->fclosesocket(conn->closesocket_client, sock);
}
- sclose(sock);
if(conn)
/* tell the multi-socket code about this */
Curl_multi_closed(conn, sock);
+ sclose(sock);
+
return 0;
}