Automatically invalidate preselected peers #1973
Labels
A-rust
Area: Updates to Rust code
C-bug
Category: This is a bug
C-cleanup
Category: This is a cleanup
C-security
Category: Security issues
I-panic
Zebra panics with an internal error message
Is your feature request related to a problem? Please describe.
In zebra_network::peer_set::set, we use an integer index to track the preselected peer index. This is a Rust anti-pattern, replacing Rust's ownership constraints with manual ownership management. (It's still safe, but if we get it wrong, it causes bugs.)
Describe the solution you'd like
Use
tower::steer
: https://docs.rs/tower/0.4.7/tower/steer/index.htmlDescribe alternatives you've considered
Instead of storing the ready peers in a Vec, store them in a
HashMap<Discover::Key>
. (The key is the remote SocketAddr of the peer's TCP connection.)Continue to use manual index tracking, which has no unit tests. It is hard to maintain, and prone to bugs.
The text was updated successfully, but these errors were encountered: