Skip to content
Snippets Groups Projects
Commit 837c7d71 authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Follow-up from arti!318

Make update_config only conditionally exported; add semver-status update.
parent d95dce7c
No related branches found
No related tags found
No related merge requests found
...@@ -267,7 +267,7 @@ impl DirMgrConfig { ...@@ -267,7 +267,7 @@ impl DirMgrConfig {
/// `self` are replaced with those from `new_config`. /// `self` are replaced with those from `new_config`.
/// ///
/// Any fields which aren't allowed to change at runtime are copied from self. /// 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 { DirMgrConfig {
cache_path: self.cache_path.clone(), cache_path: self.cache_path.clone(),
network_config: NetworkConfig { network_config: NetworkConfig {
...@@ -278,6 +278,15 @@ impl DirMgrConfig { ...@@ -278,6 +278,15 @@ impl DirMgrConfig {
override_net_params: new_config.override_net_params.clone(), 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 { impl DownloadScheduleConfig {
......
...@@ -620,7 +620,7 @@ impl<R: Runtime> DirMgr<R> { ...@@ -620,7 +620,7 @@ impl<R: Runtime> DirMgr<R> {
let params_changed = new_config.override_net_params() != config.override_net_params(); let params_changed = new_config.override_net_params() != config.override_net_params();
self.config self.config
.map_and_replace(|cfg| cfg.update_config(new_config)); .map_and_replace(|cfg| cfg.update_from_config(new_config));
if params_changed { if params_changed {
let _ignore_err = self.netdir.mutate(|netdir| { let _ignore_err = self.netdir.mutate(|netdir| {
......
...@@ -35,4 +35,13 @@ arti-client: ...@@ -35,4 +35,13 @@ arti-client:
api-break (experimental only): changed circmgr() and dirmgr() to return api-break (experimental only): changed circmgr() and dirmgr() to return
&Arc, not Arc. &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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment