Limit blocked PeerManager::process_events waiters to two
authorMatt Corallo <git@bluematt.me>
Wed, 6 Oct 2021 04:45:07 +0000 (04:45 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 10 May 2022 23:40:20 +0000 (23:40 +0000)
commit97711aef96556637b3f8b4336b688fbfcf4c2beb
tree1edbb5f80c2e425952c0db5bab9d82c239241380
parent4f50a94a3f6b9f9b2f047d319983f10ed0f3e88d
Limit blocked PeerManager::process_events waiters to two

Only one instance of PeerManager::process_events can run at a time,
and each run always finishes all available work before returning.
Thus, having several threads blocked on the process_events lock
doesn't accomplish anything but blocking more threads.

Here we limit the number of blocked calls on process_events to two
- one processing events and one blocked at the top which will
process all available events after the first completes.
lightning/src/ln/peer_handler.rs