mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
[BUG] check for global.maxconn before doing accept()
If the accept() is done before checking for global.maxconn, we can accept too many connections and encounter a lack of file descriptors when trying to connect to the server. This is the cause of the "cannot get a server socket" message encountered in debug mode during injections with low timeouts.
This commit is contained in:
parent
06bea94266
commit
b00f9c456c
@ -76,7 +76,7 @@ int event_accept(int fd) {
|
|||||||
max_accept = max;
|
max_accept = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (p->feconn < p->maxconn && max_accept--) {
|
while (p->feconn < p->maxconn && actconn < global.maxconn && max_accept--) {
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t laddr = sizeof(addr);
|
socklen_t laddr = sizeof(addr);
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ int uxst_event_accept(int fd) {
|
|||||||
else
|
else
|
||||||
max_accept = -1;
|
max_accept = -1;
|
||||||
|
|
||||||
while (max_accept--) {
|
while (actconn < global.maxconn && max_accept--) {
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t laddr = sizeof(addr);
|
socklen_t laddr = sizeof(addr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user