Commit 5ead7c51 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Dont panic because a housekeeping thread races against orderly

shutdown.
parent 9450493d
...@@ -506,8 +506,12 @@ vca_acct(void *arg) ...@@ -506,8 +506,12 @@ vca_acct(void *arg)
while (1) { while (1) {
(void)sleep(1); (void)sleep(1);
if (vca_tcp_opt_init()) { if (vca_tcp_opt_init()) {
VTAILQ_FOREACH(ls, &heritage.socks, list) VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock == -2)
continue; // raced VCA_Shutdown
assert (ls->sock > 0);
vca_tcp_opt_set(ls->sock, 1); vca_tcp_opt_set(ls->sock, 1);
}
} }
now = VTIM_real(); now = VTIM_real();
VSC_C_main->uptime = (uint64_t)(now - t0); VSC_C_main->uptime = (uint64_t)(now - t0);
...@@ -581,7 +585,7 @@ VCA_Shutdown(void) ...@@ -581,7 +585,7 @@ VCA_Shutdown(void)
VTAILQ_FOREACH(ls, &heritage.socks, list) { VTAILQ_FOREACH(ls, &heritage.socks, list) {
i = ls->sock; i = ls->sock;
ls->sock = -1; ls->sock = -2;
(void)close(i); (void)close(i);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment