[MEDIUM] don't limit peers nor stats socket to maxconn nor maxconnrate
The peers and the stats socket are control sockets, they must not be
limited by traffic rules.
diff --git a/src/stream_sock.c b/src/stream_sock.c
index 365f52b..d673aba 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -1156,7 +1156,7 @@
return 0;
}
- if (global.cps_lim) {
+ if (global.cps_lim && !(l->options & LI_O_UNLIMITED)) {
int max = freq_ctr_remain(&global.conn_per_sec, global.cps_lim, 0);
if (unlikely(!max)) {
@@ -1193,7 +1193,7 @@
struct sockaddr_storage addr;
socklen_t laddr = sizeof(addr);
- if (unlikely(actconn >= global.maxconn)) {
+ if (unlikely(actconn >= global.maxconn) && !(l->options & LI_O_UNLIMITED)) {
limit_listener(l, &global_listener_queue);
task_schedule(global_listener_queue_task, tick_add(now_ms, 1000)); /* try again in 1 second */
return 0;
@@ -1252,12 +1252,14 @@
}
/* increase the per-process number of cumulated connections */
- update_freq_ctr(&global.conn_per_sec, 1);
- if (global.conn_per_sec.curr_ctr > global.cps_max)
- global.cps_max = global.conn_per_sec.curr_ctr;
+ if (!(l->options & LI_O_UNLIMITED)) {
+ update_freq_ctr(&global.conn_per_sec, 1);
+ if (global.conn_per_sec.curr_ctr > global.cps_max)
+ global.cps_max = global.conn_per_sec.curr_ctr;
+ actconn++;
+ }
jobs++;
- actconn++;
totalconn++;
l->nbconn++;
@@ -1273,8 +1275,9 @@
* error due to a resource shortage, and we must stop the
* listener (ret < 0).
*/
+ if (!(l->options & LI_O_UNLIMITED))
+ actconn--;
jobs--;
- actconn--;
l->nbconn--;
if (ret == 0) /* successful termination */
continue;