From c79450745893e1d2fea5ff86044dcbdc847dc7df Mon Sep 17 00:00:00 2001 From: draoi Date: Sun, 31 Mar 2024 16:44:02 +0200 Subject: [PATCH] store: fix logic error in is_connection_to_self() --- src/net/hosts/store.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/net/hosts/store.rs b/src/net/hosts/store.rs index 4d33e4024..73251d040 100644 --- a/src/net/hosts/store.rs +++ b/src/net/hosts/store.rs @@ -1003,9 +1003,11 @@ impl Hosts { pub async fn is_connection_to_self(&self, url: &Url) -> bool { let host_str = url.host_str().unwrap(); if self.settings.localnet { - self.settings.external_addrs.iter().any(|ext| host_str == ext.host_str().unwrap()) - } else { + // If on localhost, check whether this connection is to our own port. self.settings.external_addrs.iter().any(|ext| url.port() == ext.port()) + } else { + // Otherwise, check whether this connection is to our own external address. + self.settings.external_addrs.iter().any(|ext| host_str == ext.host_str().unwrap()) } }