From 26b962bea042a2ae2ffae9e3067a9d64b59cca44 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Thu, 15 Jul 2021 15:54:23 +0900 Subject: [PATCH] client: add debug info for peer endpoint changes on update --- client/src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index 2d0094c..28d301e 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -472,8 +472,7 @@ fn fetch( let mut store = DataStore::open_or_create(interface)?; let State { peers, cidrs } = Api::new(&config.server).http("GET", "/user/state")?; - let device_info = - Device::get(interface, network.backend).with_str(interface.as_str_lossy())?; + let device_info = Device::get(interface, network.backend).with_str(interface.as_str_lossy())?; let interface_public_key = device_info .public_key .as_ref() @@ -490,9 +489,11 @@ fn fetch( .find(|p| p.config.public_key.to_base64() == peer.public_key); let change = match existing_peer { - Some(existing_peer) => peer - .diff(&existing_peer.config) - .map(|diff| (PeerConfigBuilder::from(&diff), peer, "modified".normal())), + Some(existing_peer) => peer.diff(&existing_peer.config).map(|diff| { + diff.endpoint + .map(|endpoint| log::debug!(" Peer endpoint changed: {:?}", endpoint)); + (PeerConfigBuilder::from(&diff), peer, "modified".normal()) + }), None => Some((PeerConfigBuilder::from(peer), peer, "added".green())), };