| 9 | #include <lightningd/subd.h> |
| 10 | |
| 11 | static void ping_reply(struct subd *connectd, |
| 12 | const u8 *msg, const int *fds, |
| 13 | struct command *cmd) |
| 14 | { |
| 15 | u16 totlen; |
| 16 | bool sent; |
| 17 | |
| 18 | log_debug(connectd->log, "Got ping reply!"); |
| 19 | |
| 20 | if (!fromwire_connectd_ping_reply(msg, &sent, &totlen)) { |
| 21 | log_broken(connectd->log, "Malformed ping reply %s", |
| 22 | tal_hex(tmpctx, msg)); |
| 23 | was_pending(command_fail(cmd, LIGHTNINGD, |
| 24 | "Bad reply message")); |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | if (!sent) |
| 29 | was_pending(command_fail(cmd, LIGHTNINGD, |
| 30 | "Ping already pending")); |
| 31 | else { |
| 32 | struct json_stream *response = json_stream_success(cmd); |
| 33 | |
| 34 | json_add_num(response, "totlen", totlen); |
| 35 | was_pending(command_success(cmd, response)); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | static struct command_result *json_ping(struct command *cmd, |
| 40 | const char *buffer, |
nothing calls this directly
no test coverage detected