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>
This commit is contained in:
Christian Decker
2018-11-05 16:54:18 +01:00
parent 404352fc7e
commit 3abc32cbbc

View File

@@ -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 */