From 309079238ae831c178573fd9bcf931ec572c3baa Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 Jan 2015 20:03:06 +1100 Subject: [PATCH] Differentiate lock contention from failing to get a response in failed auth message --- src/stratifier.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index b50ac34c..db836fa4 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2187,6 +2187,7 @@ static int send_recv_auth(stratum_instance_t *client) ckpool_t *ckp = client->ckp; sdata_t *sdata = ckp->data; char *buf = NULL, *json_msg; + bool contended = false; char cdfield[64]; int ret = 1; json_t *val; @@ -2222,7 +2223,8 @@ static int send_recv_auth(stratum_instance_t *client) if (likely(!mutex_timedlock(&sdata->ckdb_lock, 3))) { buf = ckdb_msg_call(ckp, json_msg); mutex_unlock(&sdata->ckdb_lock); - } + } else + contended = true; free(json_msg); if (likely(buf)) { @@ -2266,7 +2268,10 @@ static int send_recv_auth(stratum_instance_t *client) json_decref(val); goto out; } - LOGWARNING("Got no auth response from ckdb :("); + if (contended) + LOGWARNING("Prolonged lock contention for ckdb while trying to authorise"); + else + LOGWARNING("Got no auth response from ckdb :("); out_fail: ret = -1; out: