diff --git a/src/conf.c b/src/conf.c index 1b12c30..19c40c0 100644 --- a/src/conf.c +++ b/src/conf.c @@ -700,6 +700,12 @@ void confdnscommit(void){ sysdnsapply(cfgns, cfgnsn); } +/* Whether names are resolved by the C library for a service of the mode: + waiting for it other than in sockpoll() */ +int sysresolves(int mode){ + return mode == RESOLVE_SYSTEM || (mode == RESOLVE_DEFAULT && !cfgnsn && !sysdnscount()); +} + /* Whether names would be resolved slowly: by the C library, or by name servers, the system's taken by default, without a cache */ static int noresolver(void){ diff --git a/src/mainconf.c b/src/mainconf.c index 14f8c77..c848aed 100644 --- a/src/mainconf.c +++ b/src/mainconf.c @@ -640,6 +640,9 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){ if(srv->o_nsfd >= 0) srv->threadperclient = 1; #endif if(srv->logger && srv->logger->type && srv->logger->type->blocks) srv->threadperclient = 1; +#ifndef STDMAIN + if(sysresolves(srv->resolvmode)) srv->threadperclient = 1; +#endif #ifndef STDMAIN if((error = copyfilter(conf->filters, srv))) return error; diff --git a/src/proxy.h b/src/proxy.h index 3dfc914..60e0a2d 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -334,6 +334,7 @@ int nsbroken(void); SOCKET nssocket(struct srvparam *srv, struct sockfuncs *sf, void *state, int side, int domain, int type, int protocol); int sockpoll(struct sockfuncs *sf, void *state, struct pollfd *fds, unsigned nfds, int timeout); void nonblock(SOCKET sock); +int sysresolves(int mode); int acceptagain(void); int socksend(struct clientparam *param, SOCKET sock, unsigned char * buf, int bufsize, int to); int socksendto(struct clientparam *param, SOCKET sock, struct sockaddr * sin, unsigned char * buf, int bufsize, int to);