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

feat : add the ability to connect to a peer #10028

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

nkysg
Copy link
Contributor

@nkysg nkysg commented Aug 2, 2024

Closes #10016

@nkysg nkysg marked this pull request as draft August 2, 2024 15:55
Copy link
Collaborator

@mattsse mattsse left a 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-api/src/lib.rs Outdated Show resolved Hide resolved
Comment on lines 593 to 592
NetworkHandleMessage::ReConnect(socket_addr, peer_id) => {
self.swarm.sessions_mut().dial_outbound(socket_addr, peer_id);
Copy link
Collaborator

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

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

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

crates/net/network-api/src/lib.rs Outdated Show resolved Hide resolved
@emhane emhane added C-enhancement New feature or request A-networking Related to networking in general labels Aug 21, 2024
@nkysg nkysg changed the title feat : Add the ability to (re)connect to a peer feat : Add the ability to connect to a peer Aug 23, 2024
@nkysg nkysg changed the title feat : Add the ability to connect to a peer feat : add the ability to connect to a peer Aug 23, 2024
add connect_peer_kind

add tests
@nkysg nkysg marked this pull request as ready for review August 23, 2024 21:37
@nkysg nkysg requested review from mattsse and emhane August 23, 2024 21:38
Copy link
Collaborator

@mattsse mattsse left a 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

@mattsse mattsse enabled auto-merge August 24, 2024 06:59
@mattsse mattsse added this pull request to the merge queue Aug 24, 2024
Merged via the queue into paradigmxyz:main with commit 22f928a Aug 24, 2024
34 checks passed
@nkysg nkysg deleted the reconnect_peer branch August 24, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add to the peers or network handler the ability to (re)connect to a peer
3 participants