🐛 bug: flip hashmap key and value so peers are de-duped by IP instead of claimed MAC.

main
_ 2021-12-06 20:43:52 -06:00
parent 4955119074
commit f47fb4f1ba
1 changed files with 2 additions and 2 deletions

View File

@ -123,14 +123,14 @@ fn client () -> Result <(), AppError> {
_ => continue,
};
peers.insert (peer_mac_addr, remote_addr);
peers.insert (remote_addr, peer_mac_addr);
}
let mut peers: Vec <_> = peers.into_iter ().collect ();
peers.sort ();
println! ("Found {} peers:", peers.len ());
for (mac, ip) in &peers {
for (ip, mac) in &peers {
match mac {
Some (mac) => println! ("{} = {}", MacAddress::new (*mac), ip.ip ()),
None => println! ("<Unknown> = {}", ip),