MEDIUM: servers: Add a way to keep idle connections alive.
Add a new keyword for servers, "idle-timeout". If set, unused connections are
kept alive until the timeout happens, and will be picked for reuse if no
other connection is available.
diff --git a/include/types/connection.h b/include/types/connection.h
index cd9f1e7..745546c 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -444,7 +444,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 */
- struct timeval idle_tv; /* Time the connection was added to the idle list */
+ unsigned int idle_time; /* Time the connection was added to the idle list */
};
/* PROTO token registration */
diff --git a/include/types/server.h b/include/types/server.h
index 70e621a..bb53523 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -221,6 +221,9 @@
struct list *priv_conns; /* private idle connections attached to stream interfaces */
struct list *idle_conns; /* sharable idle connections attached or not to a stream interface */
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 */
struct task *warmup; /* the task dedicated to the warmup when slowstart is set */
struct conn_src conn_src; /* connection source settings */