improve bad share handling

(reported by cohcho, thank you)
This commit is contained in:
Jethro Grassie 2020-01-25 01:31:36 -05:00
parent 7ec47709fa
commit dd16769ab6
No known key found for this signature in database
GPG key ID: DE8ED755616565BB

View file

@ -2585,17 +2585,6 @@ client_on_read(struct bufferevent *bev, void *ctx)
return;
}
if (client->bad_shares > MAX_BAD_SHARES)
{
char body[ERROR_BODY_MAX];
stratum_get_error_body(body, client->json_id, too_bad);
evbuffer_add(output, body, strlen(body));
log_info(too_bad);
evbuffer_drain(input, len);
client_clear(bev);
return;
}
while ((line = evbuffer_readln(input, &n, EVBUFFER_EOL_LF)))
{
json_object *message = json_tokener_parse(line);
@ -2661,6 +2650,16 @@ client_on_read(struct bufferevent *bev, void *ctx)
client_clear(bev);
return;
}
if (client->bad_shares > MAX_BAD_SHARES)
{
char body[ERROR_BODY_MAX];
stratum_get_error_body(body, client->json_id, too_bad);
evbuffer_add(output, body, strlen(body));
log_info(too_bad);
evbuffer_drain(input, len);
client_clear(bev);
return;
}
}
}