Skip to content

Commit

Permalink
Limit race probability
Browse files Browse the repository at this point in the history
  • Loading branch information
neacsu committed Nov 18, 2024
1 parent 6dc9b79 commit 9155742
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/wireguard/src/peer_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ impl<St: Storage + Clone + 'static> PeerController<St> {
);
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
}
tokio::spawn(async move {
if let Err(e) = handle.run().await {
log::error!("Peer handle shut down ungracefully - {e}");
Expand Down

0 comments on commit 9155742

Please sign in to comment.