1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

sapi/fcgi: update listen queue size handling. (#13939)

the default backlog does not necessarily need to be higher than 128,
however for systems like haiku it s mor benefitial to be actually lower.
This commit is contained in:
David CARLIER
2024-04-10 23:46:41 +01:00
committed by GitHub
parent 4a0ec3de46
commit c2553a28e1

View File

@@ -1918,10 +1918,17 @@ consult the installation file that came with this distribution, or visit \n\
#endif
if (bindpath) {
int backlog = 128;
int backlog = MIN(SOMAXCONN, 128);
if (getenv("PHP_FCGI_BACKLOG")) {
backlog = atoi(getenv("PHP_FCGI_BACKLOG"));
}
if (backlog < -1 || backlog > SOMAXCONN) {
fprintf(stderr, "Invalid backlog %d, needs to be between -1 and %d\n", backlog, SOMAXCONN);
#ifdef ZTS
tsrm_shutdown();
#endif
return FAILURE;
}
fcgi_fd = fcgi_listen(bindpath, backlog);
if (fcgi_fd < 0) {
fprintf(stderr, "Couldn't create FastCGI listen socket on port %s\n", bindpath);