Browse Source

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>
trytravis
Christian Decker 6 years ago
parent
commit
3abc32cbbc
  1. 6
      lightningd/plugin.c

6
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 */ /* Add to map so we can find it later when routing the response */
uintmap_add(&plugin->plugins->pending_requests, req->id, req); 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, "{" out->json = tal_fmt(out, "{"
"\"jsonrpc\": \"2.0\", " "\"jsonrpc\": \"2.0\", "
"\"method\": \"%s\", " "\"method\": \"%s\", "
"\"params\" : %s, " "\"params\" : %s, "
"\"id\" : %" PRIu64 " }\n", "\"id\" : %" PRIu64 " }\n\n",
method, params, request_id); method, params, request_id);
/* Queue and notify the writer */ /* Queue and notify the writer */

Loading…
Cancel
Save