From 7017cb040c398461c186dfd10d9a8a9e85a0fb2d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 5 Aug 2015 16:35:23 +0200 Subject: [PATCH] MINOR: server: add a list of safe, already reused idle connections These ones are considered safe as they have already been reused. They will be useful in "aggressive" and "always" http-reuse modes in order to place the first request of a connection with the least risk. --- include/types/server.h | 1 + src/hlua.c | 2 ++ src/server.c | 1 + 3 files changed, 4 insertions(+) diff --git a/include/types/server.h b/include/types/server.h index 411ea4b42..cbeead9bd 100644 --- a/include/types/server.h +++ b/include/types/server.h @@ -168,6 +168,7 @@ struct server { struct list actconns; /* active connections */ 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 task *warmup; /* the task dedicated to the warmup when slowstart is set */ struct conn_src conn_src; /* connection source settings */ diff --git a/src/hlua.c b/src/hlua.c index df3904f06..678935165 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -5062,6 +5062,7 @@ void hlua_init(void) LIST_INIT(&socket_tcp.pendconns); LIST_INIT(&socket_tcp.priv_conns); LIST_INIT(&socket_tcp.idle_conns); + LIST_INIT(&socket_tcp.safe_conns); socket_tcp.state = SRV_ST_RUNNING; /* early server setup */ socket_tcp.last_change = 0; socket_tcp.id = "LUA-TCP-CONN"; @@ -5107,6 +5108,7 @@ void hlua_init(void) LIST_INIT(&socket_ssl.pendconns); LIST_INIT(&socket_ssl.priv_conns); LIST_INIT(&socket_ssl.idle_conns); + LIST_INIT(&socket_ssl.safe_conns); socket_ssl.state = SRV_ST_RUNNING; /* early server setup */ socket_ssl.last_change = 0; socket_ssl.id = "LUA-SSL-CONN"; diff --git a/src/server.c b/src/server.c index e33f68645..b7a498c26 100644 --- a/src/server.c +++ b/src/server.c @@ -888,6 +888,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr LIST_INIT(&newsrv->pendconns); LIST_INIT(&newsrv->priv_conns); LIST_INIT(&newsrv->idle_conns); + LIST_INIT(&newsrv->safe_conns); do_check = 0; do_agent = 0; newsrv->flags = 0;