diff --git a/src/net/channel.rs b/src/net/channel.rs index 6beac3ac1..fb8eba4a1 100644 --- a/src/net/channel.rs +++ b/src/net/channel.rs @@ -480,7 +480,7 @@ impl Channel { session.type_id() } - fn p2p(&self) -> P2pPtr { + pub(in crate::net) fn p2p(&self) -> P2pPtr { self.session().p2p() } diff --git a/src/net/hosts.rs b/src/net/hosts.rs index 4a09d0ac7..472803fb7 100644 --- a/src/net/hosts.rs +++ b/src/net/hosts.rs @@ -1098,6 +1098,11 @@ impl Hosts { pub(in crate::net) async fn register_channel(&self, channel: ChannelPtr) { let address = channel.address().clone(); + // This is an attempt to skip any Tor (and similar-behaving) inbound connections + if channel.p2p().settings().read().await.inbound_addrs.contains(&address) { + return + } + // This will panic if we are already connected to this peer, this peer // is suspended, or this peer is currently being inserted into the hostlist. // None of these scenarios should ever happen.