From 923eb44796bcd70c6e662e5e9bd154edc6589329 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 Jan 2015 21:23:10 +1100 Subject: [PATCH] Cache value of ssends --- src/stratifier.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 022dbc93..b80dda30 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1289,6 +1289,7 @@ static void stratum_broadcast(sdata_t *sdata, json_t *val) { stratum_instance_t *instance, *tmp; ckmsg_t *bulk_send = NULL; + ckmsgq_t *ssends; if (unlikely(!val)) { LOGERR("Sent null json to stratum_broadcast"); @@ -1316,13 +1317,15 @@ static void stratum_broadcast(sdata_t *sdata, json_t *val) if (!bulk_send) return; + ssends = sdata->ssends; + mutex_lock(sdata->ssends->lock); - if (sdata->ssends->msgs) - DL_CONCAT(sdata->ssends->msgs, bulk_send); + if (ssends->msgs) + DL_CONCAT(ssends->msgs, bulk_send); else - sdata->ssends->msgs = bulk_send; - pthread_cond_signal(sdata->ssends->cond); - mutex_unlock(sdata->ssends->lock); + ssends->msgs = bulk_send; + pthread_cond_signal(ssends->cond); + mutex_unlock(ssends->lock); } static void stratum_add_send(sdata_t *sdata, json_t *val, int64_t client_id)