MINOR: config: add a new tune.idle-pool.shared global setting.

Enables ('on') or disables ('off') sharing of idle connection pools between
threads for a same server. The default is to share them between threads in
order to minimize the number of persistent connections to a server, and to
optimize the connection reuse rate. But to help with debugging or when
suspecting a bug in HAProxy around connection reuse, it can be convenient to
forcefully disable this idle pool sharing between multiple threads, and force
this option to "off". The default is on.

This could have been nice to have during the idle connections debugging,
but it's not too late to add it!
diff --git a/src/backend.c b/src/backend.c
index 0b4cb4c..f87940b 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1107,6 +1107,10 @@
 	if (conn)
 		goto done;
 
+	/* pool sharing globally disabled ? */
+	if (!(global.tune.options & GTUNE_IDLE_POOL_SHARED))
+		goto done;
+
 	/* Are we allowed to pick from another thread ? We'll still try
 	 * it if we're running low on FDs as we don't want to create
 	 * extra conns in this case, otherwise we can give up if we have
diff --git a/src/haproxy.c b/src/haproxy.c
index c8c869a..e733d45 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1788,6 +1788,9 @@
 #if defined(SO_REUSEPORT)
 	global.tune.options |= GTUNE_USE_REUSEPORT;
 #endif
+#ifdef USE_THREAD
+	global.tune.options |= GTUNE_IDLE_POOL_SHARED;
+#endif
 
 	pid = getpid();
 	progname = *argv;
diff --git a/src/server.c b/src/server.c
index ac32e1c..a016b7b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -5333,6 +5333,25 @@
 	return task;
 }
 
+/* config parser for global "tune.idle-pool.shared", accepts "on" or "off" */
+static int cfg_parse_idle_pool_shared(char **args, int section_type, struct proxy *curpx,
+                                      struct proxy *defpx, const char *file, int line,
+                                      char **err)
+{
+	if (too_many_args(1, args, err, NULL))
+		return -1;
+
+	if (strcmp(args[1], "on") == 0)
+		global.tune.options |= GTUNE_IDLE_POOL_SHARED;
+	else if (strcmp(args[1], "off") == 0)
+		global.tune.options &= ~GTUNE_IDLE_POOL_SHARED;
+	else {
+		memprintf(err, "'%s' expects either 'on' or 'off' but got '%s'.", args[0], args[1]);
+		return -1;
+	}
+	return 0;
+}
+
 /* config parser for global "tune.pool-{low,high}-fd-ratio" */
 static int cfg_parse_pool_fd_ratio(char **args, int section_type, struct proxy *curpx,
                                    struct proxy *defpx, const char *file, int line,
@@ -5360,6 +5379,7 @@
 
 /* config keyword parsers */
 static struct cfg_kw_list cfg_kws = {ILH, {
+	{ CFG_GLOBAL, "tune.idle-pool.shared",       cfg_parse_idle_pool_shared },
 	{ CFG_GLOBAL, "tune.pool-high-fd-ratio",     cfg_parse_pool_fd_ratio },
 	{ CFG_GLOBAL, "tune.pool-low-fd-ratio",      cfg_parse_pool_fd_ratio },
 	{ 0, NULL, NULL }