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

Function finish_report

lightningd/memdump.c:120–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120static void finish_report(struct leak_detect *leaks)
121{
122 bool found_leak;
123 struct json_stream *response;
124 const u8 *msg;
125
126 /* If it timed out, we free ourselved and exit! */
127 if (!leaks->cmd) {
128 tal_free(leaks);
129 return;
130 }
131
132 /* Check for our own leaks. */
133 if (lightningd_check_leaks(leaks->cmd))
134 tal_arr_expand(&leaks->leakers, "lightningd");
135
136 /* Check hsmd for leaks. */
137 msg = hsm_sync_req(tmpctx, leaks->cmd->ld, take(towire_hsmd_dev_memleak(NULL)));
138 if (!fromwire_hsmd_dev_memleak_reply(msg, &found_leak))
139 fatal("Bad HSMD_DEV_MEMLEAK_REPLY: %s", tal_hex(tmpctx, msg));
140
141 if (found_leak)
142 report_subd_memleak(leaks, leaks->cmd->ld->hsm);
143
144 response = json_stream_success(leaks->cmd);
145 json_array_start(response, "leaks");
146 for (size_t num_leakers = 0;
147 num_leakers < tal_count(leaks->leakers);
148 num_leakers++) {
149 json_object_start(response, NULL);
150 json_add_string(response, "subdaemon", leaks->leakers[num_leakers]);
151 json_object_end(response);
152 }
153 json_array_end(response);
154
155 /* Command is now done. */
156 was_pending(command_success(leaks->cmd, response));
157}
158
159static void leak_detect_timeout(struct leak_detect *leak_detect)
160{

Callers 1

leak_detect_timeoutFunction · 0.85

Calls 14

tal_freeFunction · 0.85
lightningd_check_leaksFunction · 0.85
tal_hexFunction · 0.85
json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
hsm_sync_reqFunction · 0.70
fatalFunction · 0.70
report_subd_memleakFunction · 0.70
json_stream_successFunction · 0.70
was_pendingFunction · 0.70

Tested by

no test coverage detected