MEDIUM: servers: Add a command to limit the number of idling connections.
Add a new command, "pool-max-conn" that sets the maximum number of connections
waiting in the orphan idling connections list (as activated with idle-timeout).
Using "-1" means unlimited. Using pools is now dependant on this.
diff --git a/include/types/connection.h b/include/types/connection.h
index bcc2965..eff1001 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -446,7 +446,7 @@
struct sockaddr_storage from; /* client address, or address to spoof when connecting to the server */
struct sockaddr_storage to; /* address reached by the client, or address to connect to */
} addr; /* addresses of the remote side, client for producer and server for consumer */
- unsigned int idle_time; /* Time the connection was added to the idle list */
+ unsigned int idle_time; /* Time the connection was added to the idle list, or 0 if not in the idle list */
};
/* PROTO token registration */
diff --git a/include/types/server.h b/include/types/server.h
index bb53523..2eef2c3 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -223,7 +223,9 @@
struct list *safe_conns; /* safe idle connections attached to stream interfaces, shared */
struct list *idle_orphan_conns; /* Orphan connections idling */
unsigned int idle_timeout; /* Time to keep an idling orphan connection alive */
- struct task **idle_task; /* task responsible for cleaning idle orphan connections */
+ unsigned int max_idle_conns; /* Max number of connection allowed in the orphan connections list */
+ unsigned int curr_idle_conns; /* Current number of orphan idling connections */
+ struct task **idle_task; /* task responsible for cleaning idle orphan connections */
struct task *warmup; /* the task dedicated to the warmup when slowstart is set */
struct conn_src conn_src; /* connection source settings */