summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/mgr
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* chanmgr: Remove "Ident" from AbstractChannelNick Mathewson2022-10-182-29/+2
| | | | | Thanks to our previous changes, we no longer need this type, or the methods that access it.
* chanmgr: replace the HashMap<> with a ByRelayIds.Nick Mathewson2022-10-181-246/+123
| | | | | | | | | | | | | | | | | | This is necessary so that we can look up channels (open and pending) by all of the Ids that we know about them. The operations needed here are pretty complex: to get them right, I've replaced most of the accessors on the inner `ChannelMap` with a function that holds the lock while another `FnOnce` is called. This still gets us the invariant that we can't accidentally await while holding the lock on the `ChannelMap`. I've removed the tests for the accessors that are no longer there. There are some subtleties here. Now that we have more than one kind of Id, it's possible to have a partial match. I've tried to explain all these cases in the comments. }
* chanmgr: Add identities to pending state in map.Nick Mathewson2022-10-181-1/+32
| | | | | This will let us migrate from `HashMap<Ed25519Identity, Entry>` to `ByRelayIds<Entry>`.
* chanmgr: Require HasRelayIds for AbstractChannel::BuildSpecNick Mathewson2022-10-181-3/+10
| | | | | | This is mostly a testing only change for now too, but soon I'll use it to deal with the fact that we need to know the IDs to actually build a channel at all.
* chanmgr: Require HasRelayIds for AbstractChannel.Nick Mathewson2022-10-181-0/+21
| | | | | This is mostly a testing-only change for now, but soon I'll use it so we can have IdMap for our channel map.
* chanmgr: Remove the Poisoned state from the map type.Nick Mathewson2022-10-181-38/+12
| | | | | | | | The `ByRelayIds` type doesn't have a type equivalent to `hash_map::Entry`, since it's a set type rather than a map type. Therefore, the only plausible way to do entry mutation will be to remove the old entry and insert a new one. And so, we no longer need a "poisoned" state.
* Rename mgr::ChannelFactory to mgr::AbstractChannelFactoryNick Mathewson2022-10-121-2/+2
| | | | | | | | | This is an internal type (distinct from factory::ChannelFactory) that we use to make the code in `tor_chanmgr::mgr` agnostic about what a channel actually is, and how it is actually launched. Therefore, I'm renaming it and giving better documentation in a couple of places, to prevent confusion.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-122-0/+2
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* ChanMgr: new (unimplemented) APIs for pluggable transportsNick Mathewson2022-09-231-0/+8
|
* fix nightly lintstrinity-1686a2022-08-241-1/+1
|
* channel padding: Move initial config of ChannelPaddingInstructionsIan Jackson2022-08-171-1/+1
| | | | | | | | | | | | | Making ChannelPaddingInstructions::default() accurately reflect the initial state of the reactor's padding timer simplifies the code somewhat. (When padding is wanted, parameters are computed and inserted explicitly, so the only change is that if we start out dormant, we defer setting the timer parameters until necessary.) As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827249
* channel usage: Rename CU::UserTraffic from CU::ExitIan Jackson2022-08-171-4/+4
| | | | | As suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827246
* chanmgr padding: Correct docs for padding_parameters*Ian Jackson2022-08-171-2/+5
| | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827242 These texts were out of date; one of them still mentioned `all_zeroes`.
* Fix typo in commentNick Mathewson2022-08-171-1/+1
|
* tor-chanmgr tests: Fix a minimal-versions failure (actually)Ian Jackson2022-08-171-1/+1
|
* tor-chanmgr tests: Fix a minimal-versions failureIan Jackson2022-08-171-2/+2
|
* channel padding: Correctly always send the timer parametersIan Jackson2022-08-171-5/+5
| | | | Fixes "chanmgr configuration: Avoid sending needless initial update(s)"
* Rename ChannelsParams types to ChannelPaddingInstructions (fmt)Ian Jackson2022-08-171-3/+6
| | | | Run rustfmt; no other changes.
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-172-13/+13
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826167 This makes some lines too long; I will run rustfmt in a separate commit for clarity.
* chanmgr: Fix typoIan Jackson2022-08-171-1/+1
| | | | | Reported here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826166
* chanmgr parameterize: Correct doc commentIan Jackson2022-08-171-1/+4
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826164
* chamgr NetParamsExtract: Replace direct nf_ito accessIan Jackson2022-08-171-4/+23
| | | | | It turns out that the TryFrom was infallible, which wasn't obvious with the previous code structure.
* Channel: Make mutable() and engage_padding_activities infallibleIan Jackson2022-08-172-4/+2
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826151 This gets rid of quite some Bug error paths.
* Move ChannelUsage from tor_proto to tor_chanmgrIan Jackson2022-08-172-4/+4
| | | | | | | | | | | Replace Channel::note_usage with Channel::engage_padding_activities, which unconditionally causes the channel to (start to) do netflow padding things. The condition now lives in chanmgr. Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826094