From 21f80c3ecf17a163a4da95adcf77ba6ad8528725 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 21 Sep 2015 13:34:31 +1000 Subject: [PATCH] Don't allow passthrough subclients to reconnect --- src/stratifier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 0b7890cd..36d161bf 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3343,6 +3343,12 @@ out_unlock: return ret; } +/* passthrough subclients have client_ids in the high bits */ +static inline bool passthrough_subclient(const int64_t client_id) +{ + return (client_id > 0xffffffffll); +} + /* Extranonce1 must be set here. Needs to be entered with client holding a ref * count. */ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_id, const json_t *params_val) @@ -3386,7 +3392,7 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_ session_id = int_from_sessionid(buf); LOGDEBUG("Found old session id %d", session_id); } - if (!ckp->proxy && session_id) { + if (!ckp->proxy && session_id && !passthrough_subclient(client_id)) { if ((client->enonce1_64 = disconnected_sessionid_exists(sdata, session_id, client_id))) { sprintf(client->enonce1, "%016lx", client->enonce1_64); old_match = true;