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

Function destroy_connected_subd

connectd/multiplex.c:1457–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1455}
1456
1457static void destroy_connected_subd(struct subd *subd)
1458{
1459 struct peer *peer = subd->peer;
1460 size_t pos;
1461
1462 for (pos = 0; peer->subds[pos] != subd; pos++)
1463 assert(pos < tal_count(peer->subds));
1464
1465 tal_arr_remove(&peer->subds, pos);
1466
1467 /* Make sure we try to keep reading from peer (might
1468 * have been waiting for write_to_subd) */
1469 io_wake(&peer->peer_in);
1470
1471 if (tal_count(peer->subds) == 0) {
1472 if (!peer->to_peer) {
1473 /* Nothing left */
1474 tal_free(peer);
1475 } else if (peer->draining_state == READING_FROM_SUBDS) {
1476 /* We've finished draining subds, start draining peer */
1477 drain_peer(peer);
1478 }
1479 }
1480}
1481
1482static struct subd *new_subd(struct peer *peer,
1483 const struct channel_id *channel_id)

Callers

nothing calls this directly

Calls 3

io_wakeFunction · 0.85
tal_freeFunction · 0.85
drain_peerFunction · 0.85

Tested by

no test coverage detected