From e65cd38787fe95856e233103d08f3ee4122a095a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Wed, 10 May 2017 16:06:19 +0100 Subject: [PATCH] Round-robin for upstream connections --- servers/lloadd/backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/servers/lloadd/backend.c b/servers/lloadd/backend.c index b1ad7a3119..7e2fc76f72 100644 --- a/servers/lloadd/backend.c +++ b/servers/lloadd/backend.c @@ -128,9 +128,16 @@ backend_select( Operation *op ) "selected connection %lu for client %lu msgid=%d\n", c->c_connid, op->o_client_connid, op->o_client_msgid ); + /* + * Round-robin step: + * Rotate the queue to put this connection at the end. + */ + LDAP_CIRCLEQ_MAKE_TAIL( head, c, c_next ); + b->b_n_ops_executing++; c->c_n_ops_executing++; CONNECTION_UNLOCK_INCREF(c); + ldap_pvt_thread_mutex_unlock( &b->b_mutex ); return c; }