rust-lightning/lightning
Elias Rohrer f2ecf8db15
Split PeerManager::handle_message to avoid explicit mem::drop
Previously, `handle_message` was a single large method consisting of two
logical parts: one modifying the peer state hence requiring us to hold
the `peer_lock` `MutexGuard`, and, after calling `mem::drop(peer_lock)`,
the remainder which does not only *not* require to hold the
`MutexGuard`, but relies on it being dropped to avoid double-locking.

However, the `mem::drop` was easily overlooked, making reasoning about
lock orders etc. a headache. Here, we therefore have
`handle_message` call two sub-methods reflecting the two logical parts,
allowing us to avoid the explicit `mem::drop`, while at the same time
making it less error-prone due to the two methods' signatures.
2024-04-04 11:06:07 +02:00
..
src Split PeerManager::handle_message to avoid explicit mem::drop 2024-04-04 11:06:07 +02:00
Cargo.toml Drop ahash dependency in favor of core's SipHasher 2024-02-16 20:34:41 +00:00