diff --git a/src/async_resolver/server_entry.rs b/src/async_resolver/server_entry.rs index f1fab3d8..523781e7 100644 --- a/src/async_resolver/server_entry.rs +++ b/src/async_resolver/server_entry.rs @@ -1,9 +1,11 @@ use crate::async_resolver::server_info::ServerInfo; /// Struct that holds the state of a single server for a request. +#[derive(Clone)] pub struct ServerEntry { info: ServerInfo, retransmissions: u32, + is_active: bool, } impl ServerEntry { @@ -11,11 +13,12 @@ impl ServerEntry { ServerEntry { info, retransmissions: 0, + is_active: true, } } pub fn get_info(&self) -> &ServerInfo { - &self.info + &self.info// TODO: see if this is necessary to use clone or not, in order to reuse TCP connections } pub fn get_retransmissions(&self) -> u32 { @@ -29,4 +32,12 @@ impl ServerEntry { pub fn reset_retransmissions(&mut self) { self.retransmissions = 0; } + + pub fn is_active(&self) -> bool { + self.is_active + } + + pub fn set_active(&mut self, is_active: bool) { + self.is_active = is_active; + } }