From 6765e6d9e6a32bb4fc666d744cb57e2d55d4e13b Mon Sep 17 00:00:00 2001 From: Romain Fliedel Date: Mon, 5 Nov 2018 11:01:19 +0100 Subject: ares: remove fd from multi fd set when ares is about to close the fd When using c-ares for asyn dns, the dns socket fd was silently closed by c-ares without curl being aware. curl would then 'realize' the fd has been removed at next call of Curl_resolver_getsock, and only then notify the CURLMOPT_SOCKETFUNCTION to remove fd from its poll set with CURL_POLL_REMOVE. At this point the fd is already closed. By using ares socket state callback (ARES_OPT_SOCK_STATE_CB), this patch allows curl to be notified that the fd is not longer needed for neither for write nor read. At this point by calling Curl_multi_closed we are able to notify multi with CURL_POLL_REMOVE before the fd is actually closed by ares. In asyn-ares.c Curl_resolver_duphandle we can't use ares_dup anymore since it does not allow passing a different sock_state_cb_data Closes #3238 --- lib/multiif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/multiif.h') diff --git a/lib/multiif.h b/lib/multiif.h index c8fb5ca0d..c50063dae 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -89,7 +89,7 @@ void Curl_multi_connchanged(struct Curl_multi *multi); * socket again and it gets the same file descriptor number. */ -void Curl_multi_closed(struct connectdata *conn, curl_socket_t s); +void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s); /* * Add a handle and move it into PERFORM state at once. For pushed streams. -- cgit v1.2.3