From 428182816791013fbaaaff900f55ed679b27690f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 13 Dec 2015 01:51:58 +1100 Subject: [PATCH] Fix typo dropping userproxies and simplify reconnects to just on notify --- src/generator.c | 13 +------------ src/stratifier.c | 24 ------------------------ 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/generator.c b/src/generator.c index 0c7e936d..cddd0fe9 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1323,8 +1323,7 @@ out: break; parse_method(ckp, proxi, buf); }; - } - if (!proxi->global) { + } else if (!proxi->global) { LOGNOTICE("Disabling userproxy %d:%d %s that failed authorisation as %s", proxi->id, proxi->subid, proxi->url, proxi->auth); proxi->disabled = true; @@ -1405,14 +1404,6 @@ static void stratifier_reconnect_client(ckpool_t *ckp, const int64_t id) send_proc(ckp->stratifier, buf); } -static void stratifier_reconnect_user(ckpool_t *ckp, const int userid) -{ - char buf[256]; - - sprintf(buf, "reconnuser=%d", userid); - send_proc(ckp->stratifier, buf); -} - /* Add a share to the gdata share hashlist. Returns the share id */ static int add_share(gdata_t *gdata, const int64_t client_id, const double diff) { @@ -1822,8 +1813,6 @@ out: Close(cs->fd); } proxi->alive = ret; - if (ckp->userproxy && ret && !proxi->global) - stratifier_reconnect_user(ckp, proxi->userid); return ret; } diff --git a/src/stratifier.c b/src/stratifier.c index e49d5b60..e75d69ea 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2611,22 +2611,6 @@ static void reconnect_client_id(sdata_t *sdata, const int64_t client_id) dec_instance_ref(sdata, client); } -/* Reconnect all clients with a particular userid */ -static void reconnect_user_id(sdata_t *sdata, int userid) -{ - stratum_instance_t *client, *tmp; - - LOGWARNING("Dropping user id %d", userid); - - ck_rlock(&sdata->instance_lock); - HASH_ITER(hh, sdata->stratum_instances, client, tmp) { - if (client->user_id != userid) - continue; - reconnect_client(sdata, client); - } - ck_runlock(&sdata->instance_lock); -} - /* API commands */ static user_instance_t *get_user(sdata_t *sdata, const char *username); @@ -3280,14 +3264,6 @@ retry: LOGWARNING("Stratifier failed to parse reconnclient command: %s", buf); else reconnect_client_id(sdata, client_id); - } else if (cmdmatch(buf, "reconnuser")) { - int userid; - - ret = sscanf(buf, "reconnuser=%d", &userid); - if (ret < 0) - LOGWARNING("Stratifier failed to parse reconnuser command: %s", buf); - else - reconnect_user_id(sdata, userid); } else if (cmdmatch(buf, "dropall")) { drop_allclients(ckp); } else if (cmdmatch(buf, "block")) {