[BUG] reject unix accepts when connection limit is reached

unix sockets are not attached to a real frontend, so there is
no way to disable/enable the listener depending on the global
session count. For this reason, if the global maxconn is reached
and a unix socket comes in, it will just be ignored and remain
in the poll list, which will call again indefinitely.

So we need to accept then drop incoming unix connections when
the table is full.

This should not happen with clean configurations since the global
maxconn should provide enough room for unix sockets.
This commit is contained in:
Willy Tarreau 2009-03-28 11:02:18 +01:00
parent 127334e89b
commit 2d045597f7

View File

@ -368,7 +368,7 @@ int uxst_event_accept(int fd) {
else
max_accept = -1;
while (actconn < global.maxconn && max_accept--) {
while (max_accept--) {
struct sockaddr_storage addr;
socklen_t laddr = sizeof(addr);
@ -393,7 +393,7 @@ int uxst_event_accept(int fd) {
}
}
if (l->nbconn >= l->maxconn) {
if (l->nbconn >= l->maxconn || actconn >= global.maxconn) {
/* too many connections, we shoot this one and return.
* FIXME: it would be better to simply switch the listener's
* state to LI_FULL and disable the FD. We could re-enable