Browse Source

Do not move clients from hash/linked lists while they hold a ref count

master
Con Kolivas 10 years ago
parent
commit
f11250dd2d
  1. 4
      src/stratifier.c

4
src/stratifier.c

@ -1260,7 +1260,7 @@ static void drop_client(sdata_t *sdata, int64_t id)
ck_wlock(&sdata->instance_lock); ck_wlock(&sdata->instance_lock);
client = __instance_by_id(sdata, id); client = __instance_by_id(sdata, id);
if (client) { if (client && likely(!client->ref)) {
stratum_instance_t *old_client = NULL; stratum_instance_t *old_client = NULL;
instance = client->user_instance; instance = client->user_instance;
@ -1291,6 +1291,8 @@ static void drop_client(sdata_t *sdata, int64_t id)
HASH_ITER(hh, sdata->disconnected_instances, client, tmp) { HASH_ITER(hh, sdata->disconnected_instances, client, tmp) {
if (now_t - client->disconnected_time < 600) if (now_t - client->disconnected_time < 600)
continue; continue;
if (unlikely(client->ref))
continue;
LOGINFO("Ageing disconnected instance %ld to dead", client->id); LOGINFO("Ageing disconnected instance %ld to dead", client->id);
__del_disconnected(sdata, client); __del_disconnected(sdata, client);
} }

Loading…
Cancel
Save