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;
}
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];
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);
}
@ -292,9 +295,7 @@ static int invalidate_client(ckpool_t *ckp, cdata_t *cdata, client_instance_t *c
int ret;
ret = drop_client(cdata, client);
if (ckp->passthrough)
goto out;
stratifier_drop_client(ckp, client->id);
stratifier_drop_client(ckp, client);
/* Cull old unused clients lazily when there are no more reference
* 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);
out:
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"))) {
LOGNOTICE("Adding passthrough client %"PRId64" %s", client_id, client->address);
/* We need to inform the connector process that this client
* is a passthrough and to manage its messages accordingly.
* The client_id stays on the list but we won't send anything
* to it since it's unauthorised. Set the flag just in case. */
client->authorised = false;
* is a passthrough and to manage its messages accordingly. No
* data from this client id should ever come back to this
* stratifier after this so drop the client in the stratifier. */
LOGNOTICE("Adding passthrough client %"PRId64" %s", client_id, client->address);
snprintf(buf, 255, "passthrough=%"PRId64, client_id);
send_proc(client->ckp->connector, buf);
drop_client(sdata, client_id);
return;
}

Loading…
Cancel
Save