From 3abc32cbbc6ba593ebb17053298c282e811882a0 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 5 Nov 2018 16:54:18 +0100 Subject: [PATCH] plugin: Terminate objects with an empty line to signal end This is just meant as a hint to the plugin that the message is done, and it can try to parse the buffer. Signed-off-by: Christian Decker <@cdecker> --- lightningd/plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 65e6fe85d..bef4e4f63 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -239,12 +239,14 @@ static void plugin_request_send_( /* Add to map so we can find it later when routing the response */ uintmap_add(&plugin->plugins->pending_requests, req->id, req); - /* Wrap the request in the JSON-RPC request object */ + /* Wrap the request in the JSON-RPC request object. Terminate + * with an empty line that serves as a hint that the JSON + * object is done. */ out->json = tal_fmt(out, "{" "\"jsonrpc\": \"2.0\", " "\"method\": \"%s\", " "\"params\" : %s, " - "\"id\" : %" PRIu64 " }\n", + "\"id\" : %" PRIu64 " }\n\n", method, params, request_id); /* Queue and notify the writer */