X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fgetaddrinfo.c;h=f1525ea6775c20e7f3048d8036fc17c321ae8a11;hb=c453b003094541adc6fc155bc9a7aecf788245bc;hp=01cb15ba3513d71d2377068731c4d8df8d98fb96;hpb=9267d02c3601122f74bdf3a9d21f30080a4a1a9a;p=pazpar2-moved-to-github.git diff --git a/src/getaddrinfo.c b/src/getaddrinfo.c index 01cb15b..f1525ea 100644 --- a/src/getaddrinfo.c +++ b/src/getaddrinfo.c @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2009 Index Data + Copyright (C) 2006-2010 Index Data Pazpar2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -51,6 +51,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #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 */ @@ -140,7 +149,7 @@ static void work_handler(void *vp) perform_getaddrinfo(w); } -#ifndef WIN32 +#if USE_THREADED_RESOLVER void iochan_handler(struct iochan *i, int event) { sel_thread_t p = iochan_getdata(i); @@ -186,7 +195,7 @@ int host_getaddrinfo(struct host *host) w->hostport = host->hostport; w->ipport = 0; w->host = host; -#ifndef WIN32 +#if USE_THREADED_RESOLVER if (use_thread) { if (resolver_thread == 0)