From 0ce52b94989eac820d95bb88920ac5291366874a Mon Sep 17 00:00:00 2001 From: chending Date: Mon, 4 Mar 2024 15:52:57 +0800 Subject: [PATCH] fix:fake dns --- leaf/src/app/fake_dns.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leaf/src/app/fake_dns.rs b/leaf/src/app/fake_dns.rs index f642d3b89..826d3247a 100644 --- a/leaf/src/app/fake_dns.rs +++ b/leaf/src/app/fake_dns.rs @@ -174,12 +174,12 @@ impl FakeDnsImpl { } fn allocate_ip(&mut self, domain: &str) -> Ipv4Addr { + let ip = self.get_ip(); if let Some(prev_domain) = self.ip_to_domain.insert(self.cursor, domain.to_owned()) { // Remove the entry in the reverse map to make sure we won't have // multiple domains point to a same IP. self.domain_to_ip.remove(&prev_domain); } - let ip = self.get_ip(); self.domain_to_ip.insert(domain.to_owned(), self.cursor); self.cursor += 1; ip