hosts: Skip Arti inbound connections on register_channel()

This commit is contained in:
parazyd
2024-10-01 15:19:48 +02:00
parent 59ca349b09
commit 40cbbfd325
2 changed files with 6 additions and 1 deletions

View File

@@ -480,7 +480,7 @@ impl Channel {
session.type_id()
}
fn p2p(&self) -> P2pPtr {
pub(in crate::net) fn p2p(&self) -> P2pPtr {
self.session().p2p()
}

View File

@@ -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.