diff --git a/src/stratifier.c b/src/stratifier.c index 6ea66790..42b73038 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1126,7 +1126,7 @@ static bool disconnected_sessionid_exists(sdata_t *sdata, const char *sessionid, /* Number is in BE but we don't swap either of them */ hex2bin(&session64, sessionid, 8); - ck_ilock(&sdata->instance_lock); + ck_wlock(&sdata->instance_lock); HASH_ITER(hh, sdata->stratum_instances, instance, tmp) { if (instance->id == id) continue; @@ -1140,15 +1140,12 @@ static bool disconnected_sessionid_exists(sdata_t *sdata, const char *sessionid, if (instance) { /* If we've found a matching disconnected instance, use it only * once and discard it */ - ck_ulock(&sdata->instance_lock); HASH_DEL(sdata->disconnected_instances, instance); kill_instance(sdata, instance); - ck_dwilock(&sdata->instance_lock); - ret = true; } out_unlock: - ck_uilock(&sdata->instance_lock); + ck_wunlock(&sdata->instance_lock); out: return ret; }