From 0e8fa71c110c3adf34d7186a301dbd8e2b7fec0e Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 5 May 2014 09:10:05 +1000 Subject: [PATCH] Drop the connections to clients that are unauthorised, which also makes stratifier restarts work --- src/stratifier.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index 7eeefe2e..5ae5ece9 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1273,7 +1273,15 @@ static json_t *gen_json_result(int client_id, json_t *json_msg, json_t *method_v /* We should only accept authorised requests from here on */ if (!client->authorised) { + char buf[128]; + + /* Dropping unauthorised clients here also allows the + * stratifier process to restart since it will have lost all + * the stratum instance data. Clients will just reconnect. */ ret = json_string("Unauthorised"); + LOGINFO("Dropping unauthorised client %d", client->id); + sprintf(buf, "dropclient=%d", client->id); + send_proc(&client->ckp->connector, buf); goto out; }