-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat : add the ability to connect to a peer #10028
Conversation
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.
good start,
some suggestions and naming bikeshed
crates/net/network/src/manager.rs
Outdated
NetworkHandleMessage::ReConnect(socket_addr, peer_id) => { | ||
self.swarm.sessions_mut().dial_outbound(socket_addr, peer_id); |
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.
this isn't quite right, because the peer can not exist in the peers manager.
we need to go trough the peersmanager and add this logic there, like add_and_connect
, similar to
reth/crates/net/network/src/peers.rs
Line 645 in f2bb8e7
pub(crate) fn add_peer(&mut self, peer_id: PeerId, addr: PeerAddr, fork_id: Option<ForkId>) { |
but also issue a connect message to that peer if it's unconnected, like
reth/crates/net/network/src/peers.rs
Line 806 in f2bb8e7
PeerAction::Connect { peer_id, remote_addr: peer.addr.tcp() } |
we also need some tests for this, see peersmanager and we also want an e2e test for this as weel see tests/it/connect for ref
Co-authored-by: Emilia Hane <emiliaha95@gmail.com>
add connect_peer_kind add tests
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.
clean,
I only set the state of the peer
Closes #10016