Skip to content

Commit

Permalink
fix fix ips
Browse files Browse the repository at this point in the history
  • Loading branch information
feschber committed Dec 23, 2023
1 parent e07854d commit 4de3ef7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl ClientManager {
pub fn add_client(
&mut self,
hostname: Option<String>,
fix_ips: HashSet<IpAddr>,
ips: HashSet<IpAddr>,
port: u16,
pos: Position,
) -> ClientHandle {
Expand All @@ -117,13 +117,16 @@ impl ClientManager {
// we dont know, which IP is initially active
let active_addr = None;

// store fix ip addresses
let fix_ips = ips.iter().cloned().collect();

// map ip addresses to socket addresses
let addrs = HashSet::from_iter(fix_ips.into_iter().map(|ip| SocketAddr::new(ip, port)));
let addrs = HashSet::from_iter(ips.into_iter().map(|ip| SocketAddr::new(ip, port)));

// store the client
let client = Client {
hostname,
fix_ips: vec![],
fix_ips,
handle,
active_addr,
addrs,
Expand Down

0 comments on commit 4de3ef7

Please sign in to comment.