#include "connection.h"
#include "host.h"
+/* Only use a threaded resolver on Unix that offers getaddrinfo.
+ gethostbyname is NOT reentrant.
+ */
+#if HAVE_GETADDRINFO
+#ifndef WIN32
+#define USE_THREADED_RESOLVER 1
+#endif
+#endif
+
struct work {
char *hostport; /* hostport to be resolved in separate thread */
char *ipport; /* result or NULL if it could not be resolved */
perform_getaddrinfo(w);
}
-#ifndef WIN32
+#if USE_THREADED_RESOLVER
void iochan_handler(struct iochan *i, int event)
{
sel_thread_t p = iochan_getdata(i);
w->hostport = host->hostport;
w->ipport = 0;
w->host = host;
-#ifndef WIN32
+#if USE_THREADED_RESOLVER
if (use_thread)
{
if (resolver_thread == 0)