mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
[CLEANUP] proxy: merge maintain_proxies() operation inside a single loop
This will help transforming the processing into per-proxy tasks.
This commit is contained in:
parent
bbe11b1e3c
commit
d634e7c673
43
src/proxy.c
43
src/proxy.c
@ -486,6 +486,25 @@ void maintain_proxies(int *next)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (; p; p = p->next) {
|
for (; p; p = p->next) {
|
||||||
|
/* first, let's check if we need to stop the proxy */
|
||||||
|
if (unlikely(stopping && p->state != PR_STSTOPPED)) {
|
||||||
|
int t;
|
||||||
|
t = tick_remain(now_ms, p->stop_time);
|
||||||
|
if (t == 0) {
|
||||||
|
Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
|
||||||
|
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
|
||||||
|
send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
|
||||||
|
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
|
||||||
|
stop_proxy(p);
|
||||||
|
/* try to free more memory */
|
||||||
|
pool_gc2();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*next = tick_first(*next, p->stop_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the rest below is just for frontends */
|
||||||
if (!(p->cap & PR_CAP_FE))
|
if (!(p->cap & PR_CAP_FE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -516,30 +535,6 @@ void maintain_proxies(int *next)
|
|||||||
dequeue_all_listeners(&p->listener_queue);
|
dequeue_all_listeners(&p->listener_queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stopping) {
|
|
||||||
p = proxy;
|
|
||||||
while (p) {
|
|
||||||
if (p->state != PR_STSTOPPED) {
|
|
||||||
int t;
|
|
||||||
t = tick_remain(now_ms, p->stop_time);
|
|
||||||
if (t == 0) {
|
|
||||||
Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
|
|
||||||
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
|
|
||||||
send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
|
|
||||||
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
|
|
||||||
stop_proxy(p);
|
|
||||||
/* try to free more memory */
|
|
||||||
pool_gc2();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*next = tick_first(*next, p->stop_time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user