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

Function msg_out_dev_disconnect

connectd/multiplex.c:438–470  ·  view source on GitHub ↗

--dev-disconnect can do magic things: if this returns non-NULL, free msg and do that */

Source from the content-addressed store, hash-verified

436/* --dev-disconnect can do magic things: if this returns non-NULL,
437 free msg and do that */
438static struct io_plan *msg_out_dev_disconnect(struct peer *peer, const u8 *msg)
439{
440 int type = fromwire_peektype(msg);
441
442 switch (dev_disconnect_out(&peer->id, type)) {
443 case DEV_DISCONNECT_OUT_BEFORE:
444 return io_close(peer->to_peer);
445 case DEV_DISCONNECT_OUT_AFTER:
446 /* Disallow reads from now on */
447 peer->dev_read_enabled = false;
448 free_all_subds(peer);
449 drain_peer(peer);
450 return NULL;
451 case DEV_DISCONNECT_OUT_BLACKHOLE:
452 /* Disable both reads and writes from now on */
453 peer->dev_read_enabled = false;
454 peer->dev_writes_enabled = talz(peer, u32);
455 return NULL;
456 case DEV_DISCONNECT_OUT_NORMAL:
457 return NULL;
458 case DEV_DISCONNECT_OUT_DROP:
459 /* Tell them to read again. */
460 io_wake(&peer->subds);
461 return msg_queue_wait(peer->to_peer, peer->peer_outq,
462 write_to_peer, peer);
463 case DEV_DISCONNECT_OUT_DISABLE_AFTER:
464 peer->dev_read_enabled = false;
465 peer->dev_writes_enabled = tal(peer, u32);
466 *peer->dev_writes_enabled = 1;
467 return NULL;
468 }
469 abort();
470}
471
472/* Do we have enough bytes without padding? */
473static bool have_full_encrypted_queue(const struct peer *peer)

Callers 1

write_to_peerFunction · 0.85

Calls 7

fromwire_peektypeFunction · 0.85
io_closeFunction · 0.85
free_all_subdsFunction · 0.85
drain_peerFunction · 0.85
io_wakeFunction · 0.85
abortFunction · 0.85
dev_disconnect_outFunction · 0.50

Tested by

no test coverage detected