Browse Source

Detect old session clients with an empty array in proxy mode as well

master
Con Kolivas 9 years ago
parent
commit
914be773e6
  1. 10
      src/stratifier.c

10
src/stratifier.c

@ -3525,6 +3525,7 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_
{ {
ckpool_t *ckp = client->ckp; ckpool_t *ckp = client->ckp;
sdata_t *sdata, *ckp_sdata = ckp->data; sdata_t *sdata, *ckp_sdata = ckp->data;
int session_id = 0, userid = -1;
bool old_match = false; bool old_match = false;
char sessionid[12]; char sessionid[12];
int arr_size; int arr_size;
@ -3547,7 +3548,6 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_
/* NOTE useragent is NULL prior to this so should not be used in code /* NOTE useragent is NULL prior to this so should not be used in code
* till after this point */ * till after this point */
if (arr_size > 0) { if (arr_size > 0) {
int session_id = 0;
const char *buf; const char *buf;
buf = json_string_value(json_array_get(params_val, 0)); buf = json_string_value(json_array_get(params_val, 0));
@ -3571,9 +3571,11 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_
__fill_enonce1data(sdata->current_workbase, client); __fill_enonce1data(sdata->current_workbase, client);
ck_runlock(&ckp_sdata->workbase_lock); ck_runlock(&ckp_sdata->workbase_lock);
} }
} else if (ckp->proxy) { }
int userid; } else
client->useragent = ckzalloc(1);
if (ckp->proxy) {
/* Use the session_id to tell us which user this was. /* Use the session_id to tell us which user this was.
* If it's not available, see if there's an IP address * If it's not available, see if there's an IP address
* which matches a recently disconnected session. */ * which matches a recently disconnected session. */
@ -3588,8 +3590,6 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_
sdata = user_sdata; sdata = user_sdata;
} }
} }
} else
client->useragent = ckzalloc(1);
client->sdata = sdata; client->sdata = sdata;
if (ckp->proxy) { if (ckp->proxy) {

Loading…
Cancel
Save