소스 검색

store: fix logic error in is_connection_to_self()

draoi 2 년 전
부모
커밋
c794507458
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/net/hosts/store.rs

+ 4 - 2
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())
         }
     }