]> git.bitcoin.ninja Git - rust-lightning/commit
Fix race between outbound messages and peer disconnection 2023-10-peer-race-send-discon
authorMatt Corallo <git@bluematt.me>
Wed, 18 Oct 2023 15:22:26 +0000 (15:22 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 18 Oct 2023 19:35:00 +0000 (19:35 +0000)
commit4366369ef5ed9de7a01783bddb97732c6a1eea5f
treec42608b71c701a84afdde502fcab240f8f9b0e07
parent22a0bfc073f7d7b5be39abf16b530d31ab81cd3c
Fix race between outbound messages and peer disconnection

Previously, outbound messages held in `process_events` could race
with peer disconnection, allowing a message intended for a peer
before disconnection to be sent to the same peer after
disconnection.

The fix is simple - hold the peers read lock while we fetch
pending messages from peers (as we disconnect with the write lock).
lightning/src/ln/peer_handler.rs