Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "curl_setup.h"
00024
00025 #ifdef HAVE_NETINET_IN_H
00026 #include <netinet/in.h>
00027 #endif
00028 #ifdef HAVE_NETDB_H
00029 #include <netdb.h>
00030 #endif
00031 #ifdef HAVE_ARPA_INET_H
00032 #include <arpa/inet.h>
00033 #endif
00034 #ifdef __VMS
00035 #include <in.h>
00036 #include <inet.h>
00037 #endif
00038
00039 #ifdef HAVE_PROCESS_H
00040 #include <process.h>
00041 #endif
00042
00043 #include "urldata.h"
00044 #include "sendf.h"
00045 #include "hostip.h"
00046 #include "hash.h"
00047 #include "share.h"
00048 #include "strerror.h"
00049 #include "url.h"
00050 #include "curl_memory.h"
00051
00052 #include "memdebug.h"
00053
00054
00055
00056
00057 #ifdef CURLRES_ASYNCH
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 CURLcode Curl_addrinfo_callback(struct connectdata *conn,
00070 int status,
00071 struct Curl_addrinfo *ai)
00072 {
00073 struct Curl_dns_entry *dns = NULL;
00074 CURLcode result = CURLE_OK;
00075
00076 conn->async.status = status;
00077
00078 if(CURL_ASYNC_SUCCESS == status) {
00079 if(ai) {
00080 struct Curl_easy *data = conn->data;
00081
00082 if(data->share)
00083 Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
00084
00085 dns = Curl_cache_addr(data, ai,
00086 conn->async.hostname,
00087 conn->async.port);
00088 if(!dns) {
00089
00090 Curl_freeaddrinfo(ai);
00091 result = CURLE_OUT_OF_MEMORY;
00092 }
00093
00094 if(data->share)
00095 Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
00096 }
00097 else {
00098 result = CURLE_OUT_OF_MEMORY;
00099 }
00100 }
00101
00102 conn->async.dns = dns;
00103
00104
00105
00106
00107 conn->async.done = TRUE;
00108
00109
00110
00111 return result;
00112 }
00113
00114
00115
00116
00117
00118
00119 CURLcode Curl_async_resolved(struct connectdata *conn,
00120 bool *protocol_done)
00121 {
00122 CURLcode result;
00123
00124 if(conn->async.dns) {
00125 conn->dns_entry = conn->async.dns;
00126 conn->async.dns = NULL;
00127 }
00128
00129 result = Curl_setup_conn(conn, protocol_done);
00130
00131 if(result)
00132
00133
00134 Curl_disconnect(conn, FALSE);
00135
00136 return result;
00137 }
00138
00139
00140
00141
00142
00143
00144
00145 Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
00146 const char *hostname,
00147 int port,
00148 int *waitp)
00149 {
00150 return Curl_resolver_getaddrinfo(conn, hostname, port, waitp);
00151 }
00152
00153 #endif