From f47fb4f1bab8fc5677a1211d23df7c6a2b4af679 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Mon, 6 Dec 2021 20:43:52 -0600 Subject: [PATCH] :bug: bug: flip hashmap key and value so peers are de-duped by IP instead of claimed MAC. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f8bc5a4..b61d208 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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! (" = {}", ip),