Commit f6d7d37d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

When we detect the parent absconding the CLI pipes, close the acceptor

sockets as fast as we can, so that a new copy of varnishd can get at them.

Fixes	#622



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4521 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ae480d4b
...@@ -450,6 +450,7 @@ void vca_return_session(struct sess *sp); ...@@ -450,6 +450,7 @@ void vca_return_session(struct sess *sp);
void vca_close_session(struct sess *sp, const char *why); void vca_close_session(struct sess *sp, const char *why);
void VCA_Prep(struct sess *sp); void VCA_Prep(struct sess *sp);
void VCA_Init(void); void VCA_Init(void);
void VCA_Shutdown(void);
const char *VCA_waiter_name(void); const char *VCA_waiter_name(void);
extern pthread_t VCA_thread; extern pthread_t VCA_thread;
......
...@@ -424,6 +424,21 @@ VCA_Init(void) ...@@ -424,6 +424,21 @@ VCA_Init(void)
CLI_AddFuncs(vca_cmds); CLI_AddFuncs(vca_cmds);
} }
void
VCA_Shutdown(void)
{
struct listen_sock *ls;
int i;
VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock < 0)
continue;
i = ls->sock;
ls->sock = -1;
(void)close(i);
}
}
void void
VCA_tweak_waiter(struct cli *cli, const char *arg) VCA_tweak_waiter(struct cli *cli, const char *arg)
{ {
......
...@@ -112,6 +112,7 @@ CLI_Run(void) ...@@ -112,6 +112,7 @@ CLI_Run(void)
i = CLS_Poll(cls, -1); i = CLS_Poll(cls, -1);
} while(i > 0); } while(i > 0);
VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops"); VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops");
VCA_Shutdown();
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
......
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