mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: backend: without ->connect(), allow to pick another thread's connection
If less connections than threads are established on a reverse-http gateway and these servers have a non-nul pool-min-conn, then conn_backend_get() will refrain from picking available connections from other threads. But this makes no sense for protocols for which there is no ->connect(), since there's no way the current thread will manage to establish its own connection. For such situations we should always accept to use another thread's connection. That's precisely what this patch does.
This commit is contained in:
parent
f592a0d5dd
commit
662565ddb4
@ -1204,11 +1204,16 @@ static struct connection *conn_backend_get(struct stream *s, struct server *srv,
|
||||
/* 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
|
||||
* too few idle conns.
|
||||
* too few idle conns and the server protocol supports establishing
|
||||
* connections (i.e. not a reverse-http server for example).
|
||||
*/
|
||||
if (srv->curr_idle_conns < srv->low_idle_conns &&
|
||||
ha_used_fds < global.tune.pool_low_count)
|
||||
goto done;
|
||||
ha_used_fds < global.tune.pool_low_count) {
|
||||
const struct protocol *srv_proto = protocol_lookup(srv->addr.ss_family, PROTO_TYPE_STREAM, 0);
|
||||
|
||||
if (srv_proto && srv_proto->connect)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Lookup all other threads for an idle connection, starting from last
|
||||
* unvisited thread, but always staying in the same group.
|
||||
|
Loading…
x
Reference in New Issue
Block a user