From 5ad11f2048f24b0c8902495359ac706b803cadc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Mon, 18 Nov 2024 13:33:19 +0200 Subject: [PATCH] Limit race probability (#5145) * Limit race probability * Actually assign value --- common/wireguard/src/peer_controller.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/wireguard/src/peer_controller.rs b/common/wireguard/src/peer_controller.rs index bc143745c4f..8c7d94784ae 100644 --- a/common/wireguard/src/peer_controller.rs +++ b/common/wireguard/src/peer_controller.rs @@ -194,6 +194,10 @@ impl PeerController { ); self.bw_storage_managers .insert(peer.public_key.clone(), bandwidth_storage_manager); + // try to immediately update the host information, to eliminate races + if let Ok(host_information) = self.wg_api.inner.read_interface_data() { + *self.host_information.write().await = host_information; + } tokio::spawn(async move { if let Err(e) = handle.run().await { log::error!("Peer handle shut down ungracefully - {e}");