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

Function connect_failed

lightningd/connect_control.c:358–380  ·  view source on GitHub ↗

We were trying to connect, but they disconnected. */

Source from the content-addressed store, hash-verified

356
357/* We were trying to connect, but they disconnected. */
358static void connect_failed(struct lightningd *ld,
359 const struct node_id *id,
360 enum jsonrpc_errcode errcode,
361 const char *errmsg,
362 const struct wireaddr_internal *addrhint)
363{
364 struct peer *peer;
365 struct connect *c;
366
367 /* We can have multiple connect commands: fail them all */
368 while ((c = find_connect(ld, id)) != NULL) {
369 /* They delete themselves from list */
370 was_pending(command_fail(c->cmd, errcode, "%s", errmsg));
371 }
372
373 /* If we have an active channel, then reconnect. */
374 peer = peer_by_id(ld, id);
375 if (peer && peer_any_active_channel(peer, NULL)) {
376 try_reconnect(peer, peer, addrhint);
377 } else
378 log_peer_debug(ld->log, id, "Not reconnecting: %s",
379 peer ? "no active channel" : "no channels");
380}
381
382void connect_failed_disconnect(struct lightningd *ld,
383 const struct node_id *id,

Callers 2

handle_connect_failedFunction · 0.70

Calls 6

find_connectFunction · 0.85
was_pendingFunction · 0.85
peer_by_idFunction · 0.85
command_failFunction · 0.70
peer_any_active_channelFunction · 0.70
try_reconnectFunction · 0.70

Tested by

no test coverage detected