From 15e51a75dedf943b949904f66f5e6963aca8aaaa Mon Sep 17 00:00:00 2001 From: Katia Date: Thu, 19 Sep 2024 13:29:46 +0900 Subject: [PATCH] refact: add incremetn_current_server_index in state block --- src/async_resolver/state_block.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/async_resolver/state_block.rs b/src/async_resolver/state_block.rs index 4f9257e2..76e1a941 100644 --- a/src/async_resolver/state_block.rs +++ b/src/async_resolver/state_block.rs @@ -74,6 +74,13 @@ impl StateBlock { // TODO: Implement the logic to terminate the request if the counter reaches zero. } + /// Increments the `current_server_index` of the request. + /// + /// It it used when the resolver must query the next name server in the list. + pub fn increment_current_server_index(&mut self) { + self.current_server_index = (self.current_server_index + 1)%(self.servers.len()); + } + /// Returns a reference to the `timestamp` of the request. pub fn get_timestamp(&self) -> &Instant { return &self.timestamp;