From 7ee668e50dce51051bb5b5e5040b4c98e4708a5a Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 28 Jan 2016 21:56:57 +1100 Subject: [PATCH] Don't look for bkeys with messages slated for the node since they've already been extracted --- src/connector.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/connector.c b/src/connector.c index d1b8168f..e4ee3ea3 100644 --- a/src/connector.c +++ b/src/connector.c @@ -916,30 +916,21 @@ static void send_client(cdata_t *cdata, const int64_t id, char *buf, int slen, i char *bkey = NULL; json_t *val; - if (unlikely(len > slen)) { - bkey = strstr(buf + slen - 4 - 1, "bkey"); - if (bkey) - blen = len - (bkey - buf); - } + /* Node messages will have come from the generator which will have + * already extracted any bkeys */ if (unlikely(ckp->node && !id)) { - if (bkey) { - val = json_loads(buf, JSON_DISABLE_EOF_CHECK, NULL); - if (unlikely(!val)) { - LOGWARNING("No json in bkey appended message %s", buf); - free(buf); - return; - } - json_append_bkeys(val, bkey, blen); - free(buf); - buf = json_dumps(val, JSON_COMPACT); - json_decref(val); - } LOGDEBUG("Message for node: %s", buf); send_proc(ckp->stratifier, buf); free(buf); return; } + if (unlikely(len > slen)) { + bkey = strstr(buf + slen - 4 - 1, "bkey"); + if (bkey) + blen = len - (bkey - buf); + } + /* Grab a reference to this client until the sender_send has * completed processing. Is this a passthrough subclient ? */ if (id > 0xffffffffll) {