From c437d3283bb7ebb57b31655d6c7f7a936b8aa58a Mon Sep 17 00:00:00 2001 From: ckolivas Date: Sun, 27 Dec 2015 08:38:52 +1100 Subject: [PATCH] Only try to redirect clients once in redirector mode, acting as a regular passthrough thereafter --- src/connector.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/connector.c b/src/connector.c index 916de95d..87803eb0 100644 --- a/src/connector.c +++ b/src/connector.c @@ -66,6 +66,9 @@ struct client_instance { /* Linked list of shares in redirector mode.*/ share_t *shares; + /* Has this client already been told to redirect */ + bool redirected; + /* Time this client started blocking, 0 when not blocked */ time_t blocked_time; }; @@ -771,6 +774,9 @@ static void redirect_client(ckpool_t *ckp, client_instance_t *client) char *buf; int num; + /* Set the redirected boool to only try redirecting them once */ + client->redirected = true; + num = add_redirect(ckp, cdata, client); JSON_CPACK(val, "{sosss[ssi]}", "id", json_null(), "method", "client.reconnect", "params", ckp->redirecturl[num], ckp->redirectport[num], 0); @@ -889,7 +895,7 @@ static void send_client(cdata_t *cdata, const int64_t id, char *buf) free(buf); return; } - if (ckp->redirector) + if (ckp->redirector && !client->redirected) test_redirector_shares(ckp, client, buf); }