mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +00:00
Don't add as an explicit peer if already connected
This commit is contained in:
parent
f11a08c436
commit
4914420a37
1 changed files with 11 additions and 11 deletions
|
@ -435,18 +435,18 @@ impl LibP2p {
|
|||
Some(SwarmEvent::Dialing { connection_id, .. }) => {
|
||||
log::debug!("dialing to peer in connection ID {}", &connection_id);
|
||||
}
|
||||
Some(SwarmEvent::ConnectionEstablished { peer_id, connection_id, .. }) => {
|
||||
if &peer_id == swarm.local_peer_id() {
|
||||
swarm.close_connection(connection_id);
|
||||
} else {
|
||||
log::debug!(
|
||||
"connection established to peer {} in connection ID {}",
|
||||
&peer_id,
|
||||
&connection_id,
|
||||
);
|
||||
swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id)
|
||||
}
|
||||
Some(SwarmEvent::ConnectionEstablished { peer_id, connection_id, .. }) => {
|
||||
if &peer_id == swarm.local_peer_id() {
|
||||
swarm.close_connection(connection_id);
|
||||
} else if swarm.is_connected(&peer_id) {} else {
|
||||
log::debug!(
|
||||
"connection established to peer {} in connection ID {}",
|
||||
&peer_id,
|
||||
&connection_id,
|
||||
);
|
||||
swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id)
|
||||
}
|
||||
}
|
||||
Some(SwarmEvent::Behaviour(BehaviorEvent::Gossipsub(
|
||||
GsEvent::Message { propagation_source, message, .. },
|
||||
))) => {
|
||||
|
|
Loading…
Reference in a new issue