From 1d87d5a493056edc6d1638c7cdb0033d1303d745 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 17 Mar 2015 10:55:18 +1100 Subject: [PATCH] Send connector reject message only if we can't find an active pool after 5 seconds --- src/generator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generator.c b/src/generator.c index c6a64703..539a642e 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1988,6 +1988,7 @@ static void prepare_proxy(proxy_instance_t *proxi) static proxy_instance_t *wait_best_proxy(ckpool_t *ckp, gdata_t *gdata) { proxy_instance_t *ret = NULL, *proxi, *tmp; + int retries = 0; while (42) { if (!ping_main(ckp)) @@ -2007,7 +2008,10 @@ static proxy_instance_t *wait_best_proxy(ckpool_t *ckp, gdata_t *gdata) if (ret) break; - send_proc(ckp->connector, "reject"); + /* Send reject message if we are unable to find an active + * proxy for more than 5 seconds */ + if (!((++retries) % 5)) + send_proc(ckp->connector, "reject"); sleep(1); } send_proc(ckp->connector, ret ? "accept" : "reject");