diff --git a/src/mainconf.c b/src/mainconf.c index be25534..7817d8c 100644 --- a/src/mainconf.c +++ b/src/mainconf.c @@ -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; diff --git a/src/plugins/FilePlugin/FilePlugin.c b/src/plugins/FilePlugin/FilePlugin.c index 116c869..7562ace 100644 --- a/src/plugins/FilePlugin/FilePlugin.c +++ b/src/plugins/FilePlugin/FilePlugin.c @@ -767,7 +767,10 @@ static int fp_registercallback (int what, int max_size, int preview_size, struct } +/* Its _prepoll writes the files and sends them: the service's clients each + have a thread. */ static void * fp_open(void * idata, struct srvparam * param){ + param->threadperclient = 1; return idata; } diff --git a/src/sql.c b/src/sql.c index 0f0fd99..54500dd 100644 --- a/src/sql.c +++ b/src/sql.c @@ -132,7 +132,7 @@ static void odbcclose(struct logger *lg){ } const struct logtype logtype_odbc = { - "odbc", odbcmatch, odbcinit, odbcformat, odbcwrite, odbcclose, NULL, LOGSTACKSIZE, 0, 0, 1 + "odbc", odbcmatch, odbcinit, odbcformat, odbcwrite, odbcclose, NULL, LOGSTACKSIZE, 0, 0, 1, 1 }; #endif diff --git a/src/structures.h b/src/structures.h index 2ef8bf4..3289693 100644 --- a/src/structures.h +++ b/src/structures.h @@ -667,6 +667,7 @@ struct logtype { int standard; /* kept open for the life of the process */ int text; /* writes a line of text: errors can go there */ int params; /* the string after a comma is parameters */ + int blocks; /* waits for its writes other than in sockpoll() */ }; /* What a log's queue holds: a line (log.c's struct logslot, of which this @@ -746,6 +747,9 @@ struct srvparam { int family; int resolvmode; /* RESOLVE_* */ int stacksize; + /* a thread for each client: what serves them waits other than in + sockpoll(), or must not be left by a thread to serve another */ + int threadperclient; struct extparam *config; /* the configuration it was started with */ int timeouts[12]; /* conf.timeouts as they were when the service started */ int filtermaxsize, parentretries, maxseg; /* and these */