Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically invalidate preselected peers #1973

Closed
teor2345 opened this issue Apr 1, 2021 · 2 comments
Closed

Automatically invalidate preselected peers #1973

teor2345 opened this issue Apr 1, 2021 · 2 comments
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

Comments

@teor2345
Copy link
Contributor

teor2345 commented Apr 1, 2021

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.html

Describe 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.

@teor2345 teor2345 added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage 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 P-Low and removed C-enhancement Category: This is an improvement labels Apr 1, 2021
@teor2345 teor2345 changed the title Use slotmap for automatic preselected peer inv Use a map for automatic preselected peer invalidation Apr 1, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Apr 1, 2021

Marking this as a low priority, because the code seems to work right now, and it hasn't panicked since the most recent fixes.

@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Apr 9, 2021
@teor2345 teor2345 changed the title Use a map for automatic preselected peer invalidation Automatically invalidate preselected peers May 6, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Nov 26, 2021

This was fixed by PR #3090.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants