-
Notifications
You must be signed in to change notification settings - Fork 839
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
Filter out disconnected peers when fetching available peers #4269
Filter out disconnected peers when fetching available peers #4269
Conversation
return streamAllPeers().filter(EthPeer::readyForRequests); | ||
return streamAllPeers() | ||
.filter(EthPeer::readyForRequests) | ||
.filter(peer -> !peer.isDisconnected()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems sensible enough. This would be additional protection from a race between besu disconnecting a peer and subsequently responding to that disconnect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sure I got your question, but this part is not affecting the way we process incoming messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
… for requests Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
d2b07b9
to
308abaa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return streamAllPeers().filter(EthPeer::readyForRequests); | ||
return streamAllPeers() | ||
.filter(EthPeer::readyForRequests) | ||
.filter(peer -> !peer.isDisconnected()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me!
…ger#4269) * Filter out disconnected peers when fetching available peers Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
…ger#4269) * Filter out disconnected peers when fetching available peers Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
…ger#4269) * Filter out disconnected peers when fetching available peers Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Signed-off-by: garyschulte <garyschulte@gmail.com>
…ger#4269) * Filter out disconnected peers when fetching available peers Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio fabio.difabio@consensys.net
PR description
Currently a peer that is marked as disconnected can be returned when asking
EthPeers
for available peers, but returning a disconnected peer is not useful and potentially a cause of problems since all tasks will fail on it.Not sure how much this affect peer selection in the real world, but in unit tests it happens to choose a disconnected peer for request.
In any case it seems reasonable to add this check, and we can evaluate if we also need to require that a peer is fully validated, before returning it as available
Fixed Issue(s)
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog