|
|
|
@ -3305,6 +3305,12 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void free_smsg(smsg_t *msg) |
|
|
|
|
{ |
|
|
|
|
json_decref(msg->json_msg); |
|
|
|
|
free(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Entered with client holding ref count */ |
|
|
|
|
static void parse_instance_msg(sdata_t *sdata, smsg_t *msg, stratum_instance_t *client) |
|
|
|
|
{ |
|
|
|
@ -3339,8 +3345,7 @@ static void parse_instance_msg(sdata_t *sdata, smsg_t *msg, stratum_instance_t *
|
|
|
|
|
} |
|
|
|
|
parse_method(sdata, client, client_id, id_val, method, params, msg->address); |
|
|
|
|
out: |
|
|
|
|
json_decref(val); |
|
|
|
|
free(msg); |
|
|
|
|
free_smsg(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void srecv_process(ckpool_t *ckp, char *buf) |
|
|
|
@ -3395,10 +3400,10 @@ static void srecv_process(ckpool_t *ckp, char *buf)
|
|
|
|
|
client = __instance_by_id(sdata, msg->client_id); |
|
|
|
|
/* If client_id instance doesn't exist yet, create one */ |
|
|
|
|
if (unlikely(!client)) { |
|
|
|
|
if (likely(!__dropped_instance(sdata, msg->client_id))) { |
|
|
|
|
noid = true; |
|
|
|
|
if (likely(!__dropped_instance(sdata, msg->client_id))) |
|
|
|
|
client = __stratum_add_instance(ckp, msg->client_id, server); |
|
|
|
|
else |
|
|
|
|
} else |
|
|
|
|
dropped = true; |
|
|
|
|
} else if (unlikely(client->dropped)) |
|
|
|
|
dropped = true; |
|
|
|
@ -3406,15 +3411,15 @@ static void srecv_process(ckpool_t *ckp, char *buf)
|
|
|
|
|
__inc_instance_ref(client); |
|
|
|
|
ck_wunlock(&sdata->instance_lock); |
|
|
|
|
|
|
|
|
|
if (unlikely(noid)) { |
|
|
|
|
if (unlikely(dropped)) { |
|
|
|
|
/* Client may be NULL here */ |
|
|
|
|
LOGNOTICE("Stratifier skipped dropped instance %ld message server %d", |
|
|
|
|
msg->client_id, server); |
|
|
|
|
free_smsg(msg); |
|
|
|
|
goto out; |
|
|
|
|
} |
|
|
|
|
if (unlikely(noid)) |
|
|
|
|
LOGINFO("Stratifier added instance %ld server %d", client->id, server); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
parse_instance_msg(sdata, msg, client); |
|
|
|
|
dec_instance_ref(sdata, client); |
|
|
|
|