MCPcopy Create free account
hub / github.com/ElementsProject/lightning / ping_reply

Function ping_reply

lightningd/ping.c:11–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <lightningd/subd.h>
10
11static 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
39static struct command_result *json_ping(struct command *cmd,
40 const char *buffer,

Callers

nothing calls this directly

Calls 6

tal_hexFunction · 0.85
was_pendingFunction · 0.85
command_failFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
json_add_numFunction · 0.50

Tested by

no test coverage detected