Commit 09628c73 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Propagate warm/cold transitions to VCL_EVENTs

parent f9fbfca6
...@@ -172,9 +172,22 @@ vcl_find(const char *name) ...@@ -172,9 +172,22 @@ vcl_find(const char *name)
static void static void
vcl_set_state(struct vcls *vcl, const char *state) vcl_set_state(struct vcls *vcl, const char *state)
{ {
struct vrt_ctx ctx;
int warm;
unsigned hand = 0;
vcl->warm = state[0] == '1' ? 1 : 0; assert(state[0] == '0' || state[0] == '1');
warm = state[0] == '1' ? 1 : 0;
bprintf(vcl->state, "%s", state + 1); bprintf(vcl->state, "%s", state + 1);
if (warm == vcl->warm)
return;
vcl->warm = warm;
INIT_OBJ(&ctx, VRT_CTX_MAGIC);
ctx.handling = &hand;
(void)vcl->conf->event_vcl(&ctx,
vcl->warm ? VCL_EVENT_WARM : VCL_EVENT_COLD);
} }
static int static int
...@@ -384,6 +397,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv) ...@@ -384,6 +397,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
AZ(priv); AZ(priv);
vcl = vcl_find(av[2]); vcl = vcl_find(av[2]);
AN(vcl); // MGT ensures this AN(vcl); // MGT ensures this
AN(vcl->warm); // MGT ensures this
INIT_OBJ(&ctx, VRT_CTX_MAGIC); INIT_OBJ(&ctx, VRT_CTX_MAGIC);
ctx.handling = &hand; ctx.handling = &hand;
ctx.cli = cli; ctx.cli = cli;
......
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