Browse Source

Drop passthrough proxy connection from stratifier

master
Con Kolivas 10 years ago
parent
commit
e9441f2e1a
  1. 12
      src/connector.c
  2. 10
      src/stratifier.c

12
src/connector.c

@ -274,11 +274,14 @@ static int drop_client(cdata_t *cdata, client_instance_t *client)
return fd; return fd;
} }
static void stratifier_drop_client(ckpool_t *ckp, int64_t id) static void stratifier_drop_client(ckpool_t *ckp, const client_instance_t *client)
{ {
char buf[256]; char buf[256];
sprintf(buf, "dropclient=%"PRId64, id); /* The stratifier is not in use in passthrough mode */
if (ckp->passthrough || client->passthrough)
return;
sprintf(buf, "dropclient=%"PRId64, client->id);
send_proc(ckp->stratifier, buf); send_proc(ckp->stratifier, buf);
} }
@ -292,9 +295,7 @@ static int invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t *c
int ret; int ret;
ret = drop_client(cdata, client); ret = drop_client(cdata, client);
if (ckp->passthrough) stratifier_drop_client(ckp, client);
goto out;
stratifier_drop_client(ckp, client->id);
/* Cull old unused clients lazily when there are no more reference /* Cull old unused clients lazily when there are no more reference
* counts for them. */ * counts for them. */
@ -308,7 +309,6 @@ static int invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t *c
} }
ck_wunlock(&cdata->lock); ck_wunlock(&cdata->lock);
out:
return ret; return ret;
} }

10
src/stratifier.c

@ -3409,14 +3409,14 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64
} }
if (unlikely(cmdmatch(method, "mining.passthrough"))) { if (unlikely(cmdmatch(method, "mining.passthrough"))) {
LOGNOTICE("Adding passthrough client %"PRId64" %s", client_id, client->address);
/* We need to inform the connector process that this client /* We need to inform the connector process that this client
* is a passthrough and to manage its messages accordingly. * is a passthrough and to manage its messages accordingly. No
* The client_id stays on the list but we won't send anything * data from this client id should ever come back to this
* to it since it's unauthorised. Set the flag just in case. */ * stratifier after this so drop the client in the stratifier. */
client->authorised = false; LOGNOTICE("Adding passthrough client %"PRId64" %s", client_id, client->address);
snprintf(buf, 255, "passthrough=%"PRId64, client_id); snprintf(buf, 255, "passthrough=%"PRId64, client_id);
send_proc(client->ckp->connector, buf); send_proc(client->ckp->connector, buf);
drop_client(sdata, client_id);
return; return;
} }

Loading…
Cancel
Save