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

Function msg_out_dev_disconnect

connectd/multiplex.c:435–467  ·  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

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