mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
jsonrpc: add double '\n' to end of JSON RPC commands.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0c3f85d931
commit
b2378654d7
@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
### Added
|
||||
|
||||
- JSON API: use `\n\n` to terminate responses, for simplified parsing.
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
@ -22,6 +24,7 @@ changes.
|
||||
- JSON API: uppercase invoices now parsed correctly (broken in 0.6.2).
|
||||
- pylightning: handle multiple simultanous RPC replies reliably.
|
||||
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
|
@ -363,7 +363,7 @@ void command_success(struct command *cmd, struct json_stream *result)
|
||||
assert(cmd);
|
||||
assert(cmd->have_json_stream);
|
||||
if (cmd->jcon)
|
||||
jcon_append(cmd->jcon, " }\n");
|
||||
jcon_append(cmd->jcon, " }\n\n");
|
||||
if (cmd->ok)
|
||||
*(cmd->ok) = true;
|
||||
tal_free(cmd);
|
||||
@ -375,7 +375,7 @@ void command_failed(struct command *cmd, struct json_stream *result)
|
||||
assert(cmd->have_json_stream);
|
||||
/* Have to close error */
|
||||
if (cmd->jcon)
|
||||
jcon_append(cmd->jcon, " } }\n");
|
||||
jcon_append(cmd->jcon, " } }\n\n");
|
||||
if (cmd->ok)
|
||||
*(cmd->ok) = false;
|
||||
tal_free(cmd);
|
||||
@ -418,7 +418,7 @@ static void json_command_malformed(struct json_connection *jcon,
|
||||
jcon_append(jcon,
|
||||
tal_fmt(tmpctx, " \"error\" : "
|
||||
"{ \"code\" : %d,"
|
||||
" \"message\" : \"%s\" } }\n",
|
||||
" \"message\" : \"%s\" } }\n\n",
|
||||
JSONRPC2_INVALID_REQUEST, error));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user