Skip to content

Commit

Permalink
add serverEntry struct and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
justRkive committed Aug 7, 2024
1 parent 5f6632a commit a542197
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/async_resolver/server_entry.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use crate::async_resolver::server_info::ServerInfo;

/// Struct that holds the state of a single server for a request.
pub struct ServerEntry {
info: ServerInfo,
retransmissions: u32,
}

impl ServerEntry {
pub fn new(info: ServerInfo) -> ServerEntry {
ServerEntry {
info,
retransmissions: 0,
}
}

pub fn get_info(&self) -> &ServerInfo {
&self.info
}

pub fn get_retransmissions(&self) -> u32 {
self.retransmissions
}

pub fn increment_retransmissions(&mut self) {
self.retransmissions += 1;
}

pub fn reset_retransmissions(&mut self) {
self.retransmissions = 0;
}
}

0 comments on commit a542197

Please sign in to comment.