-
Notifications
You must be signed in to change notification settings - Fork 976
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
Bootstrap node can't add the connected node into peers using examples/distributed-key-value-store in public network #5445
Comments
And if I use server B as bootstrap node, server A as new-joined node, the problem is the same |
It may be linked to #5349 |
You might want to try adding an external address with |
I solved this problem by using both SwarmEvent::NewExternalAddrCandidate { address } => {
swarm.add_external_address(address);
}
SwarmEvent::NewExternalAddrOfPeer { peer_id, address } => {
swarm.behaviour_mut().kademlia.add_address(&peer_id, address);
}
SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. } => {
if let libp2p::core::ConnectedPoint::Dialer { address, .. } = endpoint {
tracing::info!("Add address {:?}", address);
swarm.behaviour_mut().kademlia.add_address(&peer_id, address);
}
}
SwarmEvent::Behaviour(BehaviourEvent::Identify(identify::Event::Received {
peer_id,
info: identify::Info { listen_addrs, observed_addr, protocols, .. },
})) => {
if protocols.iter().any(|p| *p == kad::PROTOCOL_NAME) {
for addr in listen_addrs {
swarm
.behaviour_mut()
.kademlia
.add_address(&peer_id, addr);
}
}
} |
I use two Azure servers in public network environments,
The bootstrap node runs
examples/distributed-key-value-store
example, listening on 3000 portAnd the new-joined node runs a modified
examples/distributed-key-value-store
example, add the address of the bootstrap node, and listening on 3000 port too.And I found that, the new-joined node B can add the bootstrap node A into peers, But the bootstrap node A can't add the new-joined node B into peers. Why? How to fix it?
bootstrap node output
new-joined node output
And if I print all events, I found
BehaviourEvent: UnroutablePeer
eventThe text was updated successfully, but these errors were encountered: