summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/mgr.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* memquota: Add a toplevel account in tor-chanmgrIan Jackson2024-10-031-0/+9
| | | | | | | | | Plumb through a top-level account. This doesn't have any channel-specific, circuit-specific or stream-specific accounts yet. tor-circmgr's and tor-hsclient's *tests* need fake account. In arti-relay, use a dummy account for now.
* tor-chanmgr: move channel selection logic to a new moduleSteven Engler2024-10-011-162/+4
|
* tor-chanmgr: improve readability of `choose_best_channel`Steven Engler2024-10-011-13/+45
|
* tor-chanmgr: support multiple channels for a relay IDSteven Engler2024-09-301-111/+243
|
* tor-chanmgr: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-111-1/+38
| | | | | | | | | The channel manager in the future will need to be able to receive incoming streams. The type of the stream depends on an associated type within `ChannelFactory`, so this commit exposes this associated type through several other types, eventually to the `ChanMgr`. The new methods are behind the experimental "relay" feature flag.
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* Make Channel non-Clone.Nick Mathewson2024-05-161-2/+2
|
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-10/+10
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-111-1/+1
| | | | cargo fmt, precisely.