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

Function destroy_connected_subd

connectd/multiplex.c:1361–1384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1359}
1360
1361static void destroy_connected_subd(struct subd *subd)
1362{
1363 struct peer *peer = subd->peer;
1364 size_t pos;
1365
1366 for (pos = 0; peer->subds[pos] != subd; pos++)
1367 assert(pos < tal_count(peer->subds));
1368
1369 tal_arr_remove(&peer->subds, pos);
1370
1371 /* Make sure we try to keep reading from peer (might
1372 * have been waiting for write_to_subd) */
1373 io_wake(&peer->peer_in);
1374
1375 if (tal_count(peer->subds) == 0) {
1376 if (!peer->to_peer) {
1377 /* Nothing left */
1378 tal_free(peer);
1379 } else if (peer->draining_state == READING_FROM_SUBDS) {
1380 /* We've finished draining subds, start draining peer */
1381 drain_peer(peer);
1382 }
1383 }
1384}
1385
1386static struct subd *new_subd(struct peer *peer,
1387 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