Services: threadperclient when names are resolved by the system

A service resolving names with the C library, sysresolve or by default
with no name server given or found, waits for it other than in
sockpoll(): each client has a thread. sysresolves() tells it for a
resolve mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir Dubrovin 2026-10-24 20:48:42 +03:00
parent 0d6b2950f0
commit fea5bae665
3 changed files with 10 additions and 0 deletions

View File

@ -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){

View File

@ -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;

View File

@ -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);