Fixed: maxchild dropped to 100 on config reload if not explicitly set, system-specific tuning hints added to doc

This commit is contained in:
Vladimir Dubrovin committed 2026-08-01 10:22:03 +03:00
1 parent 7b85f6a684
commit 763e21e053
8 files changed
+299 -25

No files matched your search

+1 -1
View File
@@ -190,7 +190,7 @@ struct extparam conf = {
.paused = 0,
.archiverc = 0,
.demon = 0,
.maxchild = 500,
.maxchild = DEFAULT_MAXCHILD,
.backlog = 0,
.needreload = 0,
.timetoexit = 0,
+1 -1
View File
@@ -2025,7 +2025,7 @@ void freeconf(struct extparam *confp){
#endif
*SAFAMILY(&confp->intsa) = AF_INET;
*SAFAMILY(&confp->extsa) = AF_INET;
confp->maxchild = 100;
confp->maxchild = DEFAULT_MAXCHILD;
confp->backlog = 0;
resolvfunc = NULL;
numservers = 0;
+1
View File
@@ -34,6 +34,7 @@
#define MAXUSERNAME 128
#define _PASSWORD_LEN 256
#define MAXNSERVERS 5
#define DEFAULT_MAXCHILD 500
#define TCPBUFSIZE 65536
#define SRVBUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
+26
View File
@@ -149,6 +149,20 @@ void * threadfunc (void *p) {
}
#undef param
#ifdef _WIN32
/* Present since Windows 7 (SO_PORT_SCALABILITY) and Windows 10 / Server 2019
(SO_REUSE_UNICASTPORT), define them if the SDK is older so the options can
still be requested. setsockopt() just fails on a system which does not
support them and the failure is ignored.
*/
#ifndef SO_PORT_SCALABILITY
#define SO_PORT_SCALABILITY 0x3006
#endif
#ifndef SO_REUSE_UNICASTPORT
#define SO_REUSE_UNICASTPORT 0x3007
#endif
#endif
struct socketoptions sockopts[] = {
#ifdef TCP_NODELAY
{TCP_NODELAY, "TCP_NODELAY"},
@@ -171,6 +185,9 @@ struct socketoptions sockopts[] = {
#ifdef SO_REUSEPORT
{SO_REUSEPORT, "SO_REUSEPORT"},
#endif
#ifdef SO_EXCLUSIVEADDRUSE
{SO_EXCLUSIVEADDRUSE, "SO_EXCLUSIVEADDRUSE"},
#endif
#ifdef SO_PORT_SCALABILITY
{SO_PORT_SCALABILITY, "SO_PORT_SCALABILITY"},
#endif
@@ -794,8 +811,15 @@ int MODULEMAINFUNC (int argc, char** argv){
if(*SAFAMILY(&srv.intsa) != AF_UNIX)
#endif
{
/* SO_REUSEADDR is not set on Windows: it is not needed to rebind a listening
port there, and it only allows another local process to bind the same
address and port, with undefined behaviour as to which socket receives the
connections. Use -olSO_EXCLUSIVEADDRUSE to prevent that instead.
*/
#ifndef _WIN32
opt = 1;
if(srv.so._setsockopt(srv.so.state, sock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)))perror("setsockopt()");
#endif
#ifdef SO_REUSEPORT
opt = 1;
srv.so._setsockopt(srv.so.state, sock, SOL_SOCKET, SO_REUSEPORT, (char *)&opt, sizeof(int));
@@ -911,8 +935,10 @@ int MODULEMAINFUNC (int argc, char** argv){
freesrvstrings(&srv, cbc_string, cbl_string);
return -6;
}
#ifndef _WIN32
opt = 1;
srv.so._setsockopt(srv.so.state, srv.cbsock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int));
#endif
#ifdef SO_REUSEPORT
opt = 1;
srv.so._setsockopt(srv.so.state, srv.cbsock, SOL_SOCKET, SO_REUSEPORT, (char *)&opt, sizeof(int));