aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/mgr.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-1/+0
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-chanmgr: Add doccomments and fix typo.Wesley Aptekar-Cassels2026-06-021-1/+3
|
* tor-chanmgr: Refactor metrics code slightly.Wesley Aptekar-Cassels2026-06-021-121/+160
|
* tor-chanmgr: Split out channels built error metrics.Wesley Aptekar-Cassels2026-06-021-3/+134
|
* tor-chanmgr: Separate inbound/outbound channel metrics.Wesley Aptekar-Cassels2026-06-021-6/+8
|
* tor-chanmgr: Add metrics.Wesley Aptekar-Cassels2026-06-021-0/+31
| | | | | | This adds a structure to initialize metrics when the `ChanMgr` is created, and adds a counter for the total number of channels built, broken down by success and failure.
* tor-chanmgr: Notify waiters when a launch is cancelledBoris Nagaev2026-05-041-40/+188
| | | | | | | | | | | | | | | | | | If a future that owns a pending channel launch is dropped after publishing the pending entry, other waiters can see the oneshot sender disappear and report "channel build task disappeared" as an internal bug. Fix this by tying pending-entry cleanup and waiter notification together. Once we take responsibility for a pending launch, every exit path now removes or upgrades the pending entry and notifies waiters with the observed result. Cancellation reports RequestCancelled, while post-build failures keep their original error instead of turning into the internal bug or retrying the launch owner. Add regression tests that cover both successive dropped launch-owner futures and a failure while installing a newly built channel, so waiters see the expected error in each case.
* relay: Pass advertise SocketAddr to channel builder instead of IpAddrDavid Goulet2026-04-091-4/+4
| | | | | | | | | | This trickles down to the tor-proto channel handshake code. But, the real need is in the channel builder in order to validate the outbound channel target. Fixes #2440 Signed-off-by: David Goulet <[email protected]>
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-301-7/+7
| | | | | | | | | | | | This object contains a melting pot of public keys, private keys and certificates. Rename it to reflect that it is channel authentication material and not "identities. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374454 Signed-off-by: David Goulet <[email protected]>
* tor-proto: change channel selection fns to take `HasChanMethod`Steven Engler2026-02-251-5/+6
|
* chanmgr: Responder relay channel now use the builder my_addrsDavid Goulet2026-02-241-4/+1
| | | | | | No need to pass from the arti relay binary our addresses when handling an incoming channel, use the one in the channel builder that an initiator channel uses.
* chanmgr: Store our relay addresses in the builderDavid Goulet2026-02-241-0/+13
| | | | | | | | | | We need those addresses when we build a relay channel in order to send them into our NETINFO cell. This adds the `with_my_addrs()` on the `ChanMgrConfig` object. Next commit will make arti-relay use it. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add a set_relay_identities() to update the RelayIdentitiesDavid Goulet2026-02-241-1/+1
| | | | | | | | | | The arti-relay crate rotates the keys at regular interval which we need to give to the ChanMgr to update its builder. This function boldly replace the default factory with the new identities including the TLS acceptor can pick up the new key. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'chan-target-addr' into 'main'David Goulet2026-02-161-2/+27
|\ | | | | | | | | | | | | tor-chanmgr: Add additional `get_or_launch()` tests and update doc comment Closes #2344 See merge request tpo/core/arti!3676
| * tor-chanmgr: add `get_or_launch()` tests using different addrsSteven Engler2026-02-121-2/+27
| | | | | | | | | | When there are two channel requests with the same identities and different socket addresses, we return the same channel.
* | Merge branch 'channel-canonical' into 'main'David Goulet2026-02-121-0/+10
|\ \ | |/ |/| | | | | Implement channel canonicity See merge request tpo/core/arti!3668
| * chan: Use Canonicity when choosing a channelDavid Goulet2026-02-121-0/+10
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-chanmgr: add `HasAddrs` bound to `AbstractChannelFactory::BuildSpec`Steven Engler2026-02-111-16/+28
|/ | | | | This will be needed later so that our channel selection functions can take a `HasAddrs`.
* chanmgr: Add inbound open channel to our listDavid Goulet2026-02-091-4/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-221-2/+5
| | | | | | | | | | | We need the advertised addresses for the NETINFO cell when opening a relay channel. Keep them in the TorRelay object so we can pass them to the ChanMgr channel handler. This will also help with config reload where only the local values in TorRelay will need to be updated. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Get rid of the builder outbound_chan_typeDavid Goulet2026-01-131-17/+0
| | | | | | | | | | | | | | | | | | | Instead, we'll simply use `RelayInitiator` if the identity keys (identities) struct is set. This avoids the problem where someone could call outbound_chan_type() of the ChanMgrConfig and get the wrong channel type if with_identities() is set after. This way, a single call, `with_identities()` is what will define the outbound channel type so no chance of errors. This also removes the cfg_if {} around the builder creation in a much more simplified version. Related to #1599 Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add ChannelType to channel manager configDavid Goulet2026-01-131-1/+18
| | | | | | | | | | This allows us to pass it to the ChanBuilder which will be able to use this type for the outbound channels. For now, we do this trick where if we have relay identities, we always consider that all outbound channels will be RelayInitiator. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Introduce a ChanMgrConfig structDavid Goulet2026-01-131-5/+35
| | | | | | | | | | | | This struct is used to pass configuration parameters to the ChanMgr when building it. At the moment, it holds the ChannelConfig and RelayIdentities (feature gated) which will be used in subsequent commits. Note that relays do require RelayIdentities to build channels. Signed-off-by: David Goulet <[email protected]>
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-0/+2
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* Merge branch 'relay-bin-4' into 'main'opara2025-11-111-3/+5
|\ | | | | | | | | arti-relay: Add OR port listener task See merge request tpo/core/arti!3396
| * tor-chanmgr: wrap the peer address in `Sensitive`Steven Engler2025-11-051-3/+5
| | | | | | | | | | For incoming connections, wrap the peer address in `Sensitive` as it could be a client.
* | Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
|/ | | | Run maint/add_warning
* opentelemetry: Add some instrument macros.Wesley Aptekar-Cassels2025-09-241-0/+6
| | | | | I've added these in places that are useful for the debugging that I've been doing.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Update code for Edition 2024Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* tor-chanmgr: Add reparameterize_kist to AbstractChannel trait.Gabriela Moldovan2025-01-151-0/+10
| | | | | Needed for the chanmgr to be able to update existing channels with new KIST settings read from the consensus.
* tor-chanmgr: remove immediately awaited async block expressionSteven Engler2024-11-271-23/+15
| | | | This shouldn't be needed anymore now that we use a `Defer`.
* tor-chanmgr: use `Defer` in `AbstractChanMgr` to handle cancellationsSteven Engler2024-11-271-18/+23
|
* tor-chanmgr: remove panics in debug buildsSteven Engler2024-11-111-4/+1
| | | | | | These were supposed to fail loudly in debug builds by panicking, but panics are mostly useless for debugging in async applications that use a runtime which catches panics. So we'll just log the error instead.
* tor-chanmgr: rename `replace_pending_channel` to ↵Steven Engler2024-10-241-5/+5
| | | | `upgrade_pending_channel_to_open`
* tor-chanmgr: improve cleanup procedure of pending channelsSteven Engler2024-10-241-30/+48
| | | | | | | | | | An attempt to make sure that there are no code paths which forget to remove a pending channel from the channel map. This also adds error-level log messages and panics during debug builds if a `PendingChannelHandle` is dropped without properly passing it to `MgrState::remove_pending_channel` or `MgrState::replace_pending_channel`.
* Revert "tor-chanmgr: `PendingChannelHandle` removes the channel when dropped"Steven Engler2024-10-211-2/+13
| | | | | | | | This reverts commit f85bc3cf849109aaa2c4da9fc8c06e7173a0543f. There were some small conflcits in `AbstractChanMgr::get_or_launch_internal`, so this wasn't a clean revert.
* tor-chanmgr: remove `handle_build_outcome`Steven Engler2024-10-151-28/+19
|
* tor-chanmgr: `PendingChannelHandle` removes the channel when droppedSteven Engler2024-10-151-6/+2
|
* tor-chanmgr: added `PendingChannelHandle`Steven Engler2024-10-151-18/+12
| | | | | This handle contains all of the details required to remove or replace a pending channel entry from the channel map.
* tor-chanmgr: refactor so we don't need `with_channels{,_and_params}`Steven Engler2024-10-151-53/+5
| | | | | | These methods on `MgrState` acquire a lock, and it's easy for calling code to also try to acquire the same lock within the closure, causing a deadlock. It's better to not expose these methods.
* tor-chanmgr: fix some incorrect commentsSteven Engler2024-10-151-4/+2
|
* tor-chanmgr: refactored `AbstractChanMgr::choose_action`Steven Engler2024-10-151-107/+27
| | | | | | | | This moves most of the channel map logic from `AbstractChanMgr::choose_action` to `MgrState::request_channel`. This is working towards being able to remove `MgrState::with_channels{,_and_params}`.
* memquota: Change ToplevelAccount to be an alias for Arc<MemoryQuotaTracker>Ian Jackson2024-10-151-0/+1
| | | | Fixes a TODO.
* tor-chanmgr: note API causes deadlocks under some conditionsSteven Engler2024-10-091-3/+4
|
* tor-chanmgr: minor code cleanupSteven Engler2024-10-091-5/+5
|
* tor-chanmgr: remove unused code pathSteven Engler2024-10-091-11/+3
|
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-031-1/+1
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-chanmgr: Make a memquota::ChannelAcocunt per channelIan Jackson2024-10-031-5/+9
| | | | | This delivers a fresh account per channel to the places where channels are actually made, but doesn't pass them to tor-proto yet.