Skip to content

Commit

Permalink
add: get_current_server and increment_current_index
Browse files Browse the repository at this point in the history
  • Loading branch information
justRkive committed Aug 6, 2024
1 parent 6d0c288 commit e8463f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/async_resolver/server_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ impl ServerState {
}
}

/// 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.name_servers.len());
}

/// Returns a refererece to the current `ServerInfo` of the request.
pub fn get_current_server(&self) -> &ServerInfo {
return &self.name_servers[self.current_server_index];
}

/// Returns a reference to the `name_servers` of the request.
pub fn get_name_servers(&self) -> &Vec<ServerInfo> {
return &self.name_servers;
Expand Down

0 comments on commit e8463f0

Please sign in to comment.