[core] adjust srv->srvconf.max_conns at startup

adjust srv->srvconf.max_conns at startup, if adjustment needed
personal/stbuehler/tests-path
Glenn Strauss 2021-07-26 01:26:47 -04:00
parent c69450ec04
commit a8c9b38118
3 changed files with 6 additions and 6 deletions

View File

@ -50,9 +50,9 @@ static void connection_reset(connection *con);
__attribute_cold__
__attribute_noinline__
static void connections_extend(server * const srv, connections * const conns) {
const uint32_t n = (srv->max_conns >= 128 && conns->size >= 16)
? (0 != conns->size) ? 128 : 128 - 16
: (srv->max_conns > 16) ? 16 : srv->max_conns;
const uint32_t n = (srv->srvconf.max_conns >= 128 && conns->size >= 16)
? (0 != conns->size) ? 128 : 128 - 16
: (srv->srvconf.max_conns > 16) ? 16 : srv->srvconf.max_conns;
if (conns->size < 128 && srv->srvconf.h2proto)
request_pool_extend(srv, n * 8);

View File

@ -473,7 +473,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
}
}
dirlist_max_in_progress = srv->max_conns >> 4;
dirlist_max_in_progress = srv->srvconf.max_conns >> 4;
if (0 == dirlist_max_in_progress) dirlist_max_in_progress = 1;
p->defaults.dir_listing = 0;

View File

@ -1758,13 +1758,13 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
log_error(srv->errh, __FILE__, __LINE__,
"can't have more connections than fds/2: %hu %d",
srv->srvconf.max_conns, srv->max_fds);
srv->max_conns = srv->max_fds/2;
srv->max_conns = srv->srvconf.max_conns = srv->max_fds/2;
} else if (srv->srvconf.max_conns) {
/* otherwise respect the wishes of the user */
srv->max_conns = srv->srvconf.max_conns;
} else {
/* or use the default: we really don't want to hit max-fds */
srv->max_conns = srv->max_fds/3;
srv->max_conns = srv->srvconf.max_conns = srv->max_fds/3;
}
/* libev backend overwrites our SIGCHLD handler and calls waitpid on SIGCHLD; we want our own SIGCHLD handling. */