summaryrefslogtreecommitdiff
path: root/lib/asyn-ares.c
diff options
context:
space:
mode:
authorBrad Spencer <bspencer@blackberry.com>2018-12-14 17:18:22 -0400
committerDaniel Stenberg <daniel@haxx.se>2019-01-07 10:05:20 +0100
commit84a30d0a419ad95c53cbdfc76eb2eb75d2e51835 (patch)
tree5a7c04df819a465e7711f9c9b0c831f5532b0326 /lib/asyn-ares.c
parentebe658c1e5a6577178981a7f406794699305be5c (diff)
downloadcurl-84a30d0a419ad95c53cbdfc76eb2eb75d2e51835.tar.gz
curl_multi_remove_handle() don't block terminating c-ares requests
Added Curl_resolver_kill() for all three resolver modes, which only blocks when necessary, along with test 1592 to confirm curl_multi_remove_handle() doesn't block unless it must. Closes #3428 Fixes #3371
Diffstat (limited to 'lib/asyn-ares.c')
-rw-r--r--lib/asyn-ares.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index 6a49566c8..04a25b321 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -199,6 +199,17 @@ void Curl_resolver_cancel(struct connectdata *conn)
}
/*
+ * We're equivalent to Curl_resolver_cancel() for the c-ares resolver. We
+ * never block.
+ */
+void Curl_resolver_kill(struct connectdata *conn)
+{
+ /* We don't need to check the resolver state because we can be called safely
+ at any time and we always do the same thing. */
+ Curl_resolver_cancel(conn);
+}
+
+/*
* destroy_async_data() cleans up async resolver data.
*/
static void destroy_async_data(struct Curl_async *async)
@@ -361,13 +372,13 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
/*
* Curl_resolver_wait_resolv()
*
- * waits for a resolve to finish. This function should be avoided since using
+ * Waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
* If 'entry' is non-NULL, make it point to the resolved dns entry
*
- * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and
- * CURLE_OPERATION_TIMEDOUT if a time-out occurred.
+ * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
+ * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
*/
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry)