From b96106a41429fa35551d758f11667ae2140b4b32 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 17 Feb 2015 13:36:55 +1100 Subject: [PATCH] Inform stratifier of deadproxy on every failed proxy_alive call --- src/generator.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/generator.c b/src/generator.c index 12925be0..45c609fd 100644 --- a/src/generator.c +++ b/src/generator.c @@ -932,6 +932,14 @@ static void store_proxy(gdata_t *gdata, proxy_instance_t *proxy) mutex_unlock(&gdata->lock); } +static void send_stratifier_deadproxy(ckpool_t *ckp, const int id, const int subid) +{ + char buf[256]; + + sprintf(buf, "deadproxy=%d:%d", id, subid); + send_proc(ckp->stratifier, buf); +} + /* Remove the subproxy from the proxi list and put it on the dead list */ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_instance_t *subproxy) { @@ -946,10 +954,7 @@ static void disable_subproxy(gdata_t *gdata, proxy_instance_t *proxi, proxy_inst mutex_unlock(&proxi->proxy_lock); if (subproxy) { - char buf[256]; - - sprintf(buf, "deadproxy=%d:%d", subproxy->id, subproxy->subid); - send_proc(gdata->ckp->stratifier, buf); + send_stratifier_deadproxy(gdata->ckp, subproxy->id, subproxy->subid); if (!parent_proxy(subproxy)) store_proxy(gdata, subproxy); } @@ -1581,6 +1586,7 @@ static bool proxy_alive(ckpool_t *ckp, server_instance_t *si, proxy_instance_t * ret = true; out: if (!ret) { + send_stratifier_deadproxy(ckp, proxi->id, proxi->subid); /* Close and invalidate the file handle */ Close(cs->fd); } else {