Add an accessor for the latest BridgeDescList.

This commit is contained in:
Nick Mathewson 2022-11-01 16:23:39 -04:00
parent faf51702ac
commit 6b94bc5e4c
1 changed files with 12 additions and 0 deletions

View File

@ -705,6 +705,18 @@ impl GuardMgrInner {
.and_then(|np| np.timely_netdir().ok())
}
/// Look up the latest [`BridgeDescList`](bridge::BridgeDescList) (if there
/// is one) from our [`BridgeDescProvider`](bridge::BridgeDescProvider) (if
/// we have one).
#[cfg(feature = "bridge-client")]
#[allow(dead_code)]
fn latest_bridge_desc_list(&self) -> Option<Arc<bridge::BridgeDescList>> {
self.bridge_desc_provider
.as_ref()
.and_then(Weak::upgrade)
.map(|bp| bp.bridges())
}
/// Run a function that takes `&mut self` and an optional NetDir.
///
/// If a NetDir is provided, use that. Otherwise, try to use the netdir