From 76561b4a6336b4107261c29e4a0dd6e83a08411e Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 22 Feb 2016 15:59:52 +1100 Subject: [PATCH] Correctly handle node messages --- src/stratifier.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 675269d3..16424f88 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3972,13 +3972,12 @@ retry: } while (!umsg); buf = umsg->buf; - if (likely(buf[0] == '{')) { - /* The bulk of the messages will be received json from the - * connector so look for this first. The srecv_process frees - * the buf heap ram */ + if (buf[0] == '{') { + json_t *val = json_loads(buf, JSON_DISABLE_EOF_CHECK, NULL); + + /* This is a message for a node */ Close(umsg->sockd); - ckmsgq_add(sdata->srecvs, umsg->buf); - umsg->buf = NULL; + ckmsgq_add(sdata->srecvs, val); goto retry; } if (cmdmatch(buf, "ping")) {