]> git.bitcoin.ninja Git - rust-lightning/commit
Make `fuzz_threaded_connections` more robust 2023-03-fix-threaded-test
authorMatt Corallo <git@bluematt.me>
Sat, 4 Mar 2023 01:16:57 +0000 (01:16 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 4 Mar 2023 01:20:11 +0000 (01:20 +0000)
commitd64e1b9027d59a61654a95a9e26e21ea7f68771f
treeb9a0eedcf66d88ef4f9fe28eb3bd3b83f966ea79
parentaf76face12e924132596479f8b54849b14414f84
Make `fuzz_threaded_connections` more robust

In `fuzz_threaded_connections`, if one thread is being run while
another is starved, and the running thread manages to call
`timer_tick_ocurred` twice after the starved thread constructs the
inbound connection but before it delivers the first bytes, we'll
receive an immediate error and `unwrap` it, causing failure.

The fix is trivial, simply remove the unwrap and return if we're
already disconnected when we do the initial read.

While we're here, we also reduce the frequency of the
`timer_tick_ocurred` calls to give us a chance to occasionally
deliver some additional messages.

Fixes #2073
lightning/src/ln/peer_handler.rs