/* */ #include "NameResolver.h" void callback(void* arg, int status, struct hostent* host) { NameResolver* resolverPtr = (NameResolver*)arg; #ifdef HAVE_LIBARES // This block is required since the assertion in ares_strerror fails // if status = ARES_EDESTRUCTION is passed to ares_strerror as 1st argument. // This does not happen in c-ares. if(status == ARES_EDESTRUCTION) { // we simply return in this case. return; } #endif if(status != ARES_SUCCESS) { #ifdef HAVE_LIBCARES resolverPtr->error = ares_strerror(status); #else resolverPtr->error = ares_strerror(status, 0); #endif // HAVE_LIBCARES resolverPtr->status = NameResolver::STATUS_ERROR; return; } memcpy(&resolverPtr->addr, *host->h_addr_list, sizeof(struct in_addr)); resolverPtr->status = NameResolver::STATUS_SUCCESS; }