Legend:
- Unmodified
- Added
- Removed
-
dns.c
r2be3612 r4a74b5b 28 28 #include <syslog.h> 29 29 30 #ifdef __NetBSD__ 31 #define NO_ASYNC 32 #endif 33 34 #ifdef NO_ASYNC 35 struct asr_result { 36 struct addrinfo* ar_addrinfo; 37 int ar_gai_errno; 38 }; 39 #else 30 40 #include <asr.h> 41 #endif 31 42 32 43 #include "icb.h" … … 86 97 { 87 98 struct icb_session *is = arg; 99 #ifdef NO_ASYNC 100 struct asr_result result; 101 #else 88 102 struct asr_query *as; 103 #endif 89 104 struct addrinfo hints; 90 105 … … 100 115 memset(&hints, 0, sizeof(hints)); 101 116 hints.ai_family = PF_UNSPEC; 117 #ifdef NO_ASYNC 118 getaddrinfo(is->hostname, NULL, &hints, &result.ar_addrinfo); 119 result.ar_gai_errno = errno; 120 dns_done_host(&result, is); 121 #else 102 122 as = getaddrinfo_async(is->hostname, NULL, &hints, NULL); 103 123 event_asr_run(as, dns_done_host, is); 124 #endif 104 125 } else { 105 126 icbd_log(is, LOG_DEBUG, "reverse dns resolution failed: %s", … … 130 151 dns_resolve(struct icb_session *is) 131 152 { 153 #ifdef NO_ASYNC 154 struct asr_result result; 155 #else 132 156 struct asr_query *as; 157 #endif 133 158 134 159 if (!dodns) … … 140 165 icbd_log(is, LOG_DEBUG, "resolving: %s", is->host); 141 166 167 #ifdef NO_ASYNC 168 getnameinfo((struct sockaddr *)&is->ss, 169 ((struct sockaddr *)&is->ss)->sa_len, is->hostname, 170 sizeof is->hostname, NULL, 0, NI_NOFQDN); 171 result.ar_gai_errno = errno; 172 dns_done_reverse(&result, is); 173 #else 142 174 as = getnameinfo_async((struct sockaddr *)&is->ss, 143 175 ((struct sockaddr *)&is->ss)->sa_len, is->hostname, 144 176 sizeof is->hostname, NULL, 0, NI_NOFQDN, NULL); 145 177 event_asr_run(as, dns_done_reverse, is); 178 #endif 146 179 } 147 180
Note:
See TracChangeset
for help on using the changeset viewer.