Services: threadperclient, a thread for each client where one is needed

A flag of the service for what cannot share a thread between clients,
once clients can be served otherwise: what waits other than in
sockpoll(), or a thread which may be unable to serve another client.
It is set for a service
- with FilePlugin, whose _prepoll writes files and sends them;
- with a -ne network namespace: a thread which failed to come back from
  it to the main namespace is not to serve another client;
- writing to an ODBC log, should the log have no thread of its own to
  write it: struct logtype has blocks, for a log waiting other than in
  sockpoll().

Nothing serves clients otherwise yet: as before, each has a thread.

Incompatible for plugins, which have to be built again with the same
version of 3proxy: struct srvparam has threadperclient, struct logtype
has blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-24 19:54:03 +03:00
1 parent b4bbcb9e9a
commit 3e7f749eb6
4 files changed
+12 -1

No files matched your search

+4
View File
@@ -632,7 +632,11 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
if(srv->i_nsfd >= 0 && (setns(srv->i_nsfd, CLONE_NEWNET) || setns(mainnsfd, CLONE_NEWNET))) return 4;
if(srv->o_nsfd >= 0 && (setns(srv->o_nsfd, CLONE_NEWNET) || setns(mainnsfd, CLONE_NEWNET))) return 4;
}
/* a thread which could not come back from the -ne namespace serves no
other client */
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((error = copyfilter(conf->filters, srv))) return error;