mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-02-17 15:21:57 +01:00
CLEANUP: backend: use a single variable for removed in srv_cleanup_idle_conns()
Probably due to older code, there's a boolean variable used to set another one which is then checked. Also the first check is made under the lock, which is unnecessary. Let's simplify this and use a single variable. This only makes the code clearer, it doesn't change the output code.
This commit is contained in:
parent
f7d1fc2b08
commit
efe519ab89
@ -7461,19 +7461,16 @@ struct task *srv_cleanup_idle_conns(struct task *task, void *context, unsigned i
|
||||
/* check all threads starting with ours */
|
||||
for (i = tid;;) {
|
||||
int max_conn;
|
||||
int j;
|
||||
int did_remove = 0;
|
||||
int removed;
|
||||
|
||||
max_conn = (exceed_conns * srv->curr_idle_thr[i]) /
|
||||
curr_idle + 1;
|
||||
|
||||
HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[i].idle_conns_lock);
|
||||
j = srv_migrate_conns_to_remove(srv, i, max_conn);
|
||||
if (j > 0)
|
||||
did_remove = 1;
|
||||
removed = srv_migrate_conns_to_remove(srv, i, max_conn);
|
||||
HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[i].idle_conns_lock);
|
||||
|
||||
if (did_remove)
|
||||
if (removed)
|
||||
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
|
||||
|
||||
if ((i = ((i + 1 == global.nbthread) ? 0 : i + 1)) == tid)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user