[MINOR] listeners: add listen_full() to mark a listener full
This is just a cleanup which removes calls to EV_FD_CLR() and state
setting everywhere in the code.
diff --git a/src/stream_sock.c b/src/stream_sock.c
index c5cd1e5..10e13cb 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -1194,8 +1194,7 @@
int ret;
if (unlikely(l->nbconn >= l->maxconn)) {
- EV_FD_CLR(l->fd, DIR_RD);
- l->state = LI_FULL;
+ listener_full(l);
return 0;
}
@@ -1221,20 +1220,16 @@
send_log(p, LOG_EMERG,
"Proxy %s reached system FD limit at %d. Please check system tunables.\n",
p->id, maxfd);
- if (l->nbconn) {
- EV_FD_CLR(l->fd, DIR_RD);
- l->state = LI_FULL;
- }
+ if (l->nbconn)
+ listener_full(l);
return 0;
case EMFILE:
if (p)
send_log(p, LOG_EMERG,
"Proxy %s reached process FD limit at %d. Please check 'ulimit-n' and restart.\n",
p->id, maxfd);
- if (l->nbconn) {
- EV_FD_CLR(l->fd, DIR_RD);
- l->state = LI_FULL;
- }
+ if (l->nbconn)
+ listener_full(l);
return 0;
case ENOBUFS:
case ENOMEM:
@@ -1242,10 +1237,8 @@
send_log(p, LOG_EMERG,
"Proxy %s reached system memory limit at %d sockets. Please check system tunables.\n",
p->id, maxfd);
- if (l->nbconn) {
- EV_FD_CLR(l->fd, DIR_RD);
- l->state = LI_FULL;
- }
+ if (l->nbconn)
+ listener_full(l);
return 0;
default:
return 0;
@@ -1291,10 +1284,10 @@
}
if (l->nbconn >= l->maxconn) {
- EV_FD_CLR(l->fd, DIR_RD);
- l->state = LI_FULL;
+ listener_full(l);
return 0;
}
+
} /* end of while (p->feconn < p->maxconn) */
return 0;
}