Skip to content

Commit

Permalink
Limit race probability (#5145)
Browse files Browse the repository at this point in the history
* Limit race probability

* Actually assign value
  • Loading branch information
neacsu authored Nov 18, 2024
1 parent 6dc9b79 commit 5ad11f2
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 = host_information;
}
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 5ad11f2

Please sign in to comment.