mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Don't add as an explicit peer if already connected
This commit is contained in:
@@ -435,18 +435,18 @@ impl LibP2p {
|
|||||||
Some(SwarmEvent::Dialing { connection_id, .. }) => {
|
Some(SwarmEvent::Dialing { connection_id, .. }) => {
|
||||||
log::debug!("dialing to peer in connection ID {}", &connection_id);
|
log::debug!("dialing to peer in connection ID {}", &connection_id);
|
||||||
}
|
}
|
||||||
Some(SwarmEvent::ConnectionEstablished { peer_id, connection_id, .. }) => {
|
Some(SwarmEvent::ConnectionEstablished { peer_id, connection_id, .. }) => {
|
||||||
if &peer_id == swarm.local_peer_id() {
|
if &peer_id == swarm.local_peer_id() {
|
||||||
swarm.close_connection(connection_id);
|
swarm.close_connection(connection_id);
|
||||||
} else {
|
} else if swarm.is_connected(&peer_id) {} else {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"connection established to peer {} in connection ID {}",
|
"connection established to peer {} in connection ID {}",
|
||||||
&peer_id,
|
&peer_id,
|
||||||
&connection_id,
|
&connection_id,
|
||||||
);
|
);
|
||||||
swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id)
|
swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Some(SwarmEvent::Behaviour(BehaviorEvent::Gossipsub(
|
Some(SwarmEvent::Behaviour(BehaviorEvent::Gossipsub(
|
||||||
GsEvent::Message { propagation_source, message, .. },
|
GsEvent::Message { propagation_source, message, .. },
|
||||||
))) => {
|
))) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user