diff --git a/src/async_resolver.rs b/src/async_resolver.rs index 12e66fd7..28e94a31 100644 --- a/src/async_resolver.rs +++ b/src/async_resolver.rs @@ -5,7 +5,6 @@ pub mod resolver_error; pub mod server_info; pub mod slist; pub mod state_block; -pub mod server_state; pub mod server_entry; use self::lookup_response::LookupResponse; diff --git a/src/async_resolver/resolution.rs b/src/async_resolver/resolution.rs index 3f2d56e1..7656a8b8 100644 --- a/src/async_resolver/resolution.rs +++ b/src/async_resolver/resolution.rs @@ -85,12 +85,11 @@ impl Resolution { let mut iter = 0..upper_limit_of_retransmission_loops; 'global_cycle: while let Some(_retransmission) = iter.next() { println!("Retransmission: {}", _retransmission); - let number_of_servers = self.state_block.get_server_state().get_servers().len(); + let number_of_servers = self.state_block.get_servers().len(); for _ in 0..number_of_servers { println!("Server retrans"); - let server_state = self.state_block.get_server_state(); - let server_entry_clone = server_state.get_current_server_entry().clone(); + let server_entry_clone = self.state_block.get_current_server_entry().clone(); if !server_entry_clone.is_active() { continue; } //start timer @@ -113,8 +112,8 @@ impl Resolution { if self.received_appropriate_response() { break 'global_cycle } - self.state_block.get_server_state().get_current_server_entry().increment_retransmissions(); - self.state_block.get_server_state().increment_current_server_index(); + self.state_block.get_current_server_entry().increment_retransmissions(); + self.state_block.increment_current_server_index(); } // // let mut servers_iter: std::slice::Iter = servers_to_query.iter(); diff --git a/src/async_resolver/state_block.rs b/src/async_resolver/state_block.rs index 7aa256ff..2acc648c 100644 --- a/src/async_resolver/state_block.rs +++ b/src/async_resolver/state_block.rs @@ -1,6 +1,5 @@ use tokio::time::Instant; -use crate::async_resolver::server_state::ServerState; use super::{server_entry::ServerEntry, server_info::ServerInfo}; /// This struct represent the state of information of a pending request. @@ -94,4 +93,8 @@ impl StateBlock { pub fn get_current_server_entry(&mut self) -> &mut ServerEntry { &mut self.servers[self.current_server_index] } + + pub fn get_servers(&self) -> &Vec { + &self.servers + } } \ No newline at end of file