diff --git a/crates/tor-dirmgr/src/config.rs b/crates/tor-dirmgr/src/config.rs index 64ca10e850a90e9c758bc4015696e3b7b5ff22ed..b082ed716e1824d6c7928c4aaa3eefe566dfc696 100644 --- a/crates/tor-dirmgr/src/config.rs +++ b/crates/tor-dirmgr/src/config.rs @@ -267,7 +267,7 @@ impl DirMgrConfig { /// `self` are replaced with those from `new_config`. /// /// Any fields which aren't allowed to change at runtime are copied from self. - pub fn update_config(&self, new_config: &DirMgrConfig) -> DirMgrConfig { + pub(crate) fn update_from_config(&self, new_config: &DirMgrConfig) -> DirMgrConfig { DirMgrConfig { cache_path: self.cache_path.clone(), network_config: NetworkConfig { @@ -278,6 +278,15 @@ impl DirMgrConfig { override_net_params: new_config.override_net_params.clone(), } } + + /// Construct a new configuration object where all replaceable fields in + /// `self` are replaced with those from `new_config`. + /// + /// Any fields which aren't allowed to change at runtime are copied from self. + #[cfg(feature = "experimental-api")] + pub fn update_config(&self, new_config: &DirMgrConfig) -> DirMgrConfig { + self.update_from_config(new_config) + } } impl DownloadScheduleConfig { diff --git a/crates/tor-dirmgr/src/lib.rs b/crates/tor-dirmgr/src/lib.rs index a0d6f5c47c250da132c48f9045f2ca4857a280c4..9a63f21fd1ef57f0206fdeab49fbdc42bc2e679a 100644 --- a/crates/tor-dirmgr/src/lib.rs +++ b/crates/tor-dirmgr/src/lib.rs @@ -620,7 +620,7 @@ impl<R: Runtime> DirMgr<R> { let params_changed = new_config.override_net_params() != config.override_net_params(); self.config - .map_and_replace(|cfg| cfg.update_config(new_config)); + .map_and_replace(|cfg| cfg.update_from_config(new_config)); if params_changed { let _ignore_err = self.netdir.mutate(|netdir| { diff --git a/doc/semver_status.md b/doc/semver_status.md index ad348cf2682c31d84af92f83f766432352389df1..61cc77f734fe44e337b8405ed01d2cfae0ad5896 100644 --- a/doc/semver_status.md +++ b/doc/semver_status.md @@ -35,4 +35,13 @@ arti-client: api-break (experimental only): changed circmgr() and dirmgr() to return &Arc, not Arc. +tor-dirmgr: + + new-api: DirMgrConfig object now has accessors. + +tor-netdoc: + + new-api (experimental only): Can modify the set of relays in an unverified + consensus. +