Browse Source

Move use of LOGINFO out of __stratum_add_instance

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

9
src/stratifier.c

@ -1226,7 +1226,6 @@ static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, int64_t id, int
instance->diff = instance->old_diff = ckp->startdiff; instance->diff = instance->old_diff = ckp->startdiff;
instance->ckp = ckp; instance->ckp = ckp;
tv_time(&instance->ldc); tv_time(&instance->ldc);
LOGINFO("Stratifier added instance %ld server %d", id, server);
HASH_ADD_I64(sdata->stratum_instances, id, instance); HASH_ADD_I64(sdata->stratum_instances, id, instance);
return instance; return instance;
} }
@ -3305,6 +3304,7 @@ static void srecv_process(ckpool_t *ckp, char *buf)
{ {
sdata_t *sdata = ckp->data; sdata_t *sdata = ckp->data;
stratum_instance_t *client; stratum_instance_t *client;
bool added = false;
smsg_t *msg; smsg_t *msg;
json_t *val; json_t *val;
int server; int server;
@ -3351,11 +3351,16 @@ static void srecv_process(ckpool_t *ckp, char *buf)
ck_wlock(&sdata->instance_lock); ck_wlock(&sdata->instance_lock);
client = __instance_by_id(sdata, msg->client_id); client = __instance_by_id(sdata, msg->client_id);
/* If client_id instance doesn't exist yet, create one */ /* If client_id instance doesn't exist yet, create one */
if (unlikely(!client)) if (unlikely(!client)) {
client = __stratum_add_instance(ckp, msg->client_id, server); client = __stratum_add_instance(ckp, msg->client_id, server);
added = true;
}
__inc_instance_ref(client); __inc_instance_ref(client);
ck_wunlock(&sdata->instance_lock); ck_wunlock(&sdata->instance_lock);
if (added)
LOGINFO("Stratifier added instance %ld server %d", client->id, server);
parse_instance_msg(sdata, msg, client); parse_instance_msg(sdata, msg, client);
dec_instance_ref(sdata, client); dec_instance_ref(sdata, client);
out: out:

Loading…
Cancel
Save