From 8271037d374e642563e074622f006986200e3762 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 16 Nov 2022 11:32:49 -0500 Subject: [PATCH] ChanMgr: Rename ChannelMap to MgrState We're doing this because the type now holds "all the mutable state in a ChanMgr", not just the map. This is a pure renaming; no documentation has been updated. Part of #606. --- crates/tor-chanmgr/src/mgr.rs | 4 ++-- crates/tor-chanmgr/src/mgr/map.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/tor-chanmgr/src/mgr.rs b/crates/tor-chanmgr/src/mgr.rs index 2c51fafc6..6689c3848 100644 --- a/crates/tor-chanmgr/src/mgr.rs +++ b/crates/tor-chanmgr/src/mgr.rs @@ -82,7 +82,7 @@ pub(crate) struct AbstractChanMgr { connector: CF, /// A map from ed25519 identity to channel, or to pending channel status. - pub(crate) channels: map::ChannelMap, + pub(crate) channels: map::MgrState, } /// Type alias for a future that we wait on to see when a pending @@ -103,7 +103,7 @@ impl AbstractChanMgr { ) -> Self { AbstractChanMgr { connector, - channels: map::ChannelMap::new(config.clone(), dormancy, netparams), + channels: map::MgrState::new(config.clone(), dormancy, netparams), } } diff --git a/crates/tor-chanmgr/src/mgr/map.rs b/crates/tor-chanmgr/src/mgr/map.rs index 44c441deb..6b09e9f8c 100644 --- a/crates/tor-chanmgr/src/mgr/map.rs +++ b/crates/tor-chanmgr/src/mgr/map.rs @@ -31,7 +31,7 @@ mod padding_test; /// `Mutex>` to limit the amount of code that can see and /// lock the Mutex here. (We're using a blocking mutex close to async /// code, so we need to be careful.) -pub(crate) struct ChannelMap { +pub(crate) struct MgrState { /// The data, within a lock inner: std::sync::Mutex>, } @@ -221,7 +221,7 @@ impl ChannelState { } } -impl ChannelMap { +impl MgrState { /// Create a new empty ChannelMap. pub(crate) fn new( config: ChannelConfig, @@ -234,7 +234,7 @@ impl ChannelMap { .unwrap_or_else(|e: tor_error::Bug| panic!("bug detected on startup: {:?}", e)); let _: Option<_> = update; // there are no channels yet, that would need to be told - ChannelMap { + MgrState { inner: std::sync::Mutex::new(Inner { channels: ByRelayIds::new(), config, @@ -517,8 +517,8 @@ mod test { use tor_llcrypto::pk::ed25519::Ed25519Identity; use tor_proto::channel::params::ChannelPaddingInstructionsUpdates; - fn new_test_channel_map() -> ChannelMap { - ChannelMap::new( + fn new_test_channel_map() -> MgrState { + MgrState::new( ChannelConfig::default(), Default::default(), &Default::default(),