Commit 9243e4a4 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Stop VCL's health-polling of backend already when we discard the VCL.

Fixes	#1141
parent 42cf6a92
......@@ -691,6 +691,8 @@ void VCA_FailSess(struct worker *w);
/* cache_backend.c */
void VBE_UseHealth(const struct director *vdi);
void VBE_DiscardHealth(const struct director *vdi);
struct vbc *VDI_GetFd(const struct director *, struct sess *sp);
int VDI_Healthy(const struct director *, const struct sess *sp);
......
......@@ -428,6 +428,25 @@ VBE_UseHealth(const struct director *vdi)
VBP_Use(vs->backend, vs->vrt->probe);
}
/*--------------------------------------------------------------------
*
*/
void
VBE_DiscardHealth(const struct director *vdi)
{
struct vdi_simple *vs;
ASSERT_CLI();
if (strcmp(vdi->name, "simple"))
return;
CAST_OBJ_NOTNULL(vs, vdi->priv, VDI_SIMPLE_MAGIC);
if (vs->vrt->probe == NULL)
return;
VBP_Remove(vs->backend, vs->vrt->probe);
}
/*--------------------------------------------------------------------
*
*/
......@@ -470,8 +489,6 @@ vdi_simple_fini(const struct director *d)
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
if (vs->vrt->probe != NULL)
VBP_Remove(vs->backend, vs->vrt->probe);
VBE_DropRefVcl(vs->backend);
free(vs->dir.vcl_name);
vs->dir.magic = 0;
......
......@@ -278,10 +278,10 @@ static void
ccf_config_discard(struct cli *cli, const char * const *av, void *priv)
{
struct vcls *vcl;
int i;
ASSERT_CLI();
(void)av;
(void)priv;
AZ(priv);
vcl = vcl_find(av[2]);
if (vcl == NULL) {
VCLI_SetResult(cli, CLIS_PARAM);
......@@ -299,6 +299,11 @@ ccf_config_discard(struct cli *cli, const char * const *av, void *priv)
VSC_C_main->n_vcl_avail--;
vcl->conf->discard = 1;
Lck_Unlock(&vcl_mtx);
/* Tickle this VCL's backends to give up health polling */
for(i = 1; i < vcl->conf->ndirector; i++)
VBE_DiscardHealth(vcl->conf->director[i]);
if (vcl->conf->busy == 0)
VCL_Nuke(vcl);
}
......
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