summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/mgr
Commit message (Collapse)AuthorAgeFilesLines
* fix: fix typosDimitris Apostolou2025-01-061-1/+1
|
* tor-chanmgr: remove panics in debug buildsSteven Engler2024-11-111-3/+0
| | | | | | 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-4/+5
| | | | `upgrade_pending_channel_to_open`
* tor-chanmgr: `remove_pending` now takes a `PendingChannelHandle`Steven Engler2024-10-241-18/+8
|
* tor-chanmgr: improve cleanup procedure of pending channelsSteven Engler2024-10-241-17/+44
| | | | | | | | | | 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-54/+21
| | | | | | | | This reverts commit f85bc3cf849109aaa2c4da9fc8c06e7173a0543f. There were some small conflcits in `AbstractChanMgr::get_or_launch_internal`, so this wasn't a clean revert.
* Merge branch 'chanmgr-select-docs' into 'main'David Goulet2024-10-171-0/+25
|\ | | | | | | | | tor-chanmgr: update comments about selecting pending channels See merge request tpo/core/arti!2544
| * tor-chanmgr: update comments about selecting pending channelsSteven Engler2024-10-161-0/+25
| |
* | tor-chanmgr: `PendingChannelHandle` removes the channel when droppedSteven Engler2024-10-151-21/+54
| |
* | tor-chanmgr: added `PendingChannelHandle`Steven Engler2024-10-151-18/+52
| | | | | | | | | | 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-25/+71
| | | | | | | | | | | | 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-1/+1
| |
* | tor-chanmgr: removed use of `with_channels` within `request_channel`Steven Engler2024-10-151-61/+66
| | | | | | | | Best reviewed with the '-w' flag to hide whitespace changes.
* | tor-chanmgr: refactored `AbstractChanMgr::choose_action`Steven Engler2024-10-151-2/+118
|/ | | | | | | | 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-1/+2
| | | | Fixes a TODO.
* tor-chanmgr: note API causes deadlocks under some conditionsSteven Engler2024-10-091-0/+12
|
* tor-chanmgr: Make a memquota::ChannelAcocunt per channelIan Jackson2024-10-032-1/+6
| | | | | 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/+2
| | | | | | | | | 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: minor doc improvementsSteven Engler2024-10-011-3/+3
|
* tor-chanmgr: add unit testsSteven Engler2024-10-011-0/+416
|
* tor-chanmgr: change `choose_best_channel` to take `IntoIterator`Steven Engler2024-10-011-1/+3
|
* tor-chanmgr: don't allow pending channels with no relay idsSteven Engler2024-10-011-1/+7
|
* tor-chanmgr: move channel selection logic to a new moduleSteven Engler2024-10-011-0/+168
|
* tor-chanmgr: support multiple channels for a relay IDSteven Engler2024-09-301-22/+49
|
* tor-chanmgr: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-112-0/+21
| | | | | | | | | 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.
* tor-netdir: Allow access to the `ConsensusBuilder` when building test netdirs.Gabriela Moldovan2024-09-091-2/+2
| | | | | This allows us to set SRVs for example (needed because by default, the test `NetDir` is built from a consensus that doesn't contain any SRVs).
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-162-9/+11
| | | | | | | | | | | | | | | | 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-132-0/+2
|
* ChannelState::ready_to_expire: return true when rem time is zeroJim Newsome2023-12-131-0/+5
| | | | | | | | | | | This fixes a race condition that would normally be fairly benign - it would result in scheduling to check for expired channels again immediately, and assuming non-zero time passes would then remove the channel. In Shadow's default time model though, zero time passes in this case, so we just keep scheduling to check again immediately forever; i.e. deadlock.
* ChannelState::ready_to_expire: refactor using let-elseJim Newsome2023-12-131-18/+14
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-232-0/+2
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-102-0/+2
|
* Add exceptions for some cases of diverging_sub_expressionNick Mathewson2023-07-101-0/+2
| | | | | | | | See here for documentation on the lint: https://rust-lang.github.io/rust-clippy/master/index.html#/diverging_sub_expression The issue here, from what I can tell, is that the lint triggers whenever you use a diverging expression as a function body within an
* chanmgr: fix a unit-default warning from clippy nightly.Nick Mathewson2023-05-181-1/+1
| | | | | | I could also have stopped using `::default()` to construct this (testing-only) object, but I think it makes more sense to turn it into a non-unit object.
* chanmgr: remove a needless mut.Nick Mathewson2023-05-111-1/+1
| | | | This fixes a warning from nightly clippy.
* tor-netdir: Update tests to parse the descriptor, make test consensus ↵Gabriela Moldovan2023-05-031-1/+2
| | | | | | lifetime configurable. Signed-off-by: Gabriela Moldovan <[email protected]>
* Errors: Mark the type of an error, for clarityIan Jackson2023-01-301-2/+2
| | | | | We want to call ErrorReport::report() on Errors, but this isn't an Error but only a string.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-272-0/+2
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuildereta2022-11-282-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | This commit makes the `ChanBuilder` type in `tor-chanmgr` usable by consumers outside of that crate, like the doc comment for `ChannelFactory` says you need to be able to do in order to turn your `TransportHelper` into something useful. As part of doing this, the `event_sender` its constructor takes needed to be dealt with, since it was a crate-internal type that came from inside the `ChanMgr`. Enter `BootstrapReporter`: an opaque wrapper around that sender, now provided as an additional argument to `ChannelFactory::connect_via_transport`. You can now construct a `ChanBuilder` outside this crate, and it'll still be able to report its bootstrap status by unwrapping this new type that's threaded through from the `ChanMgr`. (This was a fair deal of manually threading the type through all the layers in this crate!) Note that you cannot implement bootstrap updating using something that isn't `ChanBuilder` yet due to the type being entirely opaque (but, of course, we can figure out exactly what API the reporter should have later, and add that capability in).
* ChanMgr: Fix a few more conditional-compilation issuesNick Mathewson2022-11-231-0/+1
|
* ChanMgr: Implement functions that replace channel factories.Nick Mathewson2022-11-231-4/+6
| | | | | | | This commit makes it possible to replace the default channel factory (used when there is no PtMgr), and to replace the PtMgr. This is part of #659.
* ChanMgr: move the AbstractChanFactory into MgrState.Nick Mathewson2022-11-222-7/+48
| | | | | | We will want the freedom to replace this, so it needs to go behind a lock. We need to be able to Clone it cheaply now, so we're using an Arc instead of a Box.
* chanmgr: rename new_test_channel_map to new_test_state.Nick Mathewson2022-11-161-5/+5
|
* chanmgr::mgr::*: misc spelling fixes and normali[sz]ationsNick Mathewson2022-11-161-5/+5
|
* Fix up documentation that referred to a ChannelMap.Nick Mathewson2022-11-161-17/+13
|
* ChanMgr: Rename map.rs to state.rsNick Mathewson2022-11-162-0/+0
| | | | This is another pure renaming.
* ChanMgr: Rename ChannelMap to MgrStateNick Mathewson2022-11-161-5/+5
| | | | | | | | | 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.
* Fix various typos (using typos tool and hand-inspection)Nick Mathewson2022-10-182-3/+3
|
* Refactor flow control in get_or_launch.Nick Mathewson2022-10-181-3/+3
| | | | | | | Now, instead of duplicate checks in various cases, we simply go through the loop one last time. This allows us to simplify some of our other logic around here.
* Clarify a comment about the desired structure of ChanMgrNick Mathewson2022-10-181-1/+2
|