summaryrefslogtreecommitdiff
path: root/lib/hostasyn.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-31 00:10:35 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-04-25 19:47:16 +0200
commit7de2f9271c68c10ee7057c10741b0406bca6c156 (patch)
tree409facd48bf80fc9576b7b44f44cf469aeaa4c4b /lib/hostasyn.c
parent24d84da0731f680a9b19653a450d4843f190d6b8 (diff)
downloadcurl-7de2f9271c68c10ee7057c10741b0406bca6c156.tar.gz
async resolvers: further cleanups
asyn-ares.c and asyn-thread.c are two separate backends that implement the same (internal) async resolver API for libcurl to use. Backend is specified at build time. The internal resolver API is defined in asyn.h for asynch resolvers.
Diffstat (limited to 'lib/hostasyn.c')
-rw-r--r--lib/hostasyn.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/hostasyn.c b/lib/hostasyn.c
index 5269c08dc..50f6b01fb 100644
--- a/lib/hostasyn.c
+++ b/lib/hostasyn.c
@@ -127,4 +127,43 @@ CURLcode Curl_addrinfo_callback(struct connectdata *conn,
return rc;
}
+/* Call this function after Curl_connect() has returned async=TRUE and
+ then a successful name resolve has been received.
+
+ Note: this function disconnects and frees the conn data in case of
+ resolve failure */
+CURLcode Curl_async_resolved(struct connectdata *conn,
+ bool *protocol_done)
+{
+ CURLcode code;
+
+ if(conn->async.dns) {
+ conn->dns_entry = conn->async.dns;
+ conn->async.dns = NULL;
+ }
+
+ code = Curl_setup_conn(conn, protocol_done);
+
+ if(code)
+ /* We're not allowed to return failure with memory left allocated
+ in the connectdata struct, free those here */
+ Curl_disconnect(conn, FALSE); /* close the connection */
+
+ return code;
+}
+
+/*
+ * Curl_getaddrinfo() is the generic low-level name resolve API within this
+ * source file. There are several versions of this function - for different
+ * name resolve layers (selected at build-time). They all take this same set
+ * of arguments
+ */
+Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
+{
+ return Curl_resolver_getaddrinfo(conn, hostname, port, waitp);
+}
+
#endif /* CURLRES_ASYNCH */