summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/mgr.rs
Commit message (Collapse)AuthorAgeFilesLines
* channel usage: Rename CU::UserTraffic from CU::ExitIan Jackson2022-08-171-14/+26
| | | | | As suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827246
* channel engage_padding_activities: swap docs to tor0protoIan Jackson2022-08-171-10/+2
| | | | This allow us to make a working cross-reference.
* Rename ChannelsParams types to ChannelPaddingInstructions (fmt)Ian Jackson2022-08-171-2/+8
| | | | Run rustfmt; no other changes.
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-171-5/+5
| | | | | | | | 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.
* Channel: Make mutable() and engage_padding_activities infallibleIan Jackson2022-08-171-5/+3
| | | | | | | 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-171-7/+25
| | | | | | | | | | | 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
* chanmgr: Use NetDirProvider::params and Arc<dyn..Netparameters>Ian Jackson2022-08-171-11/+21
| | | | | | | | | This gets rid of many Result(). Many parameters are renamed. Test cases of the now-impossible branch are removed. Deleting the match from padding_parameters will come in a moment. I've split off that commit since it has much whitespace noise. for now, change the error type to Void.
* chanmgr testing: FakeChannel: retain the ChannelsParamsUpdatesIan Jackson2022-08-161-1/+4
|
* chanmgr configuration: Avoid sending needless initial update(s)Ian Jackson2022-08-161-2/+5
| | | | | | | | | | | Change ChannelsParams::initial_update to compare fields with their default values, and, if they're the same as the default, not to include them in the returned update. And if that update is then empty, return None. The overall effect is to avoid the call to chan.reparameterize if we're using the builtin default parameters, which is usual.
* chanmgr configuration: Hadle lack of a NetDirIan Jackson2022-08-161-9/+1
| | | | | | Now that the code that actually handles the netdir information can cope with its lack, we can change the types of the various netdir parameters and get rid of the foolish Bugs.
* Introduce ChannelConfigIan Jackson2022-08-161-4/+17
| | | | | This commit is just the necessary plumbing. The config is currently empty. We'll add something to it, for padding control, later.
* Provide ChannelUsage and plumb it all the way downIan Jackson2022-08-161-13/+23
| | | | | | | | | | | | | Channel padding depends on what the channel is being used for. We therefore need to let the channel code know this information. The implementation of the per-channel padding control logic will be in the new note_usage function, which for now is simply a stub. A future commit will introduce a `PaddingControlState` which lives in the channel frontend; consult the doc comment for that type to see why the plumbing through the channel manager terminates in the channel frontend.
* chanmgr: Introduce get_or_launch_internalIan Jackson2022-08-161-0/+10
| | | | This is going to be useful in a moment.
* channel reparameterize: Change error typeIan Jackson2022-08-161-5/+3
| | | | This is going to be able to fail in other ways too, sadly.
* dormancy: Plumb through to chanmgr reconfigure_generalIan Jackson2022-08-161-6/+19
| | | | | | | | | | | | | | | The chanmgr remembers the last dormancy state it was told. We invent a chanmgr-specific Dormancy which the arti-client code knows how to convert from the richer top-level dormant status. This avoids having to have everyone know all the variants of the top-level state. To call reconfigure_general, we must also obtain and plumb through a netdir. Right now we must return an internal error if there is in fact no netdir, because reconfigure_general does not yet cope with a missing netdir. Nothing actually *uses* the dormancy yet.
* chanmgr: reconfigure_general: Rename fn and change typesIan Jackson2022-08-161-0/+11
| | | | | | | | | | | | | | | This function is going to become the code for controlling channels, in general. (Including padding control.) Right now it doesn't do most of the things. In this commit: * Change the prototype and the name now. * Pass `()` for the dormancy and config, adding TODOs. * Provide update_netdir method on AbstractChanMgr, and call that, rather than having the ChanMgr go directly into the channel. (That will enable us to test that `update_netdir` method with test cases that don't have a complete ChanMgr.)
* channel params: Rename initial_update (from total_update)Ian Jackson2022-08-161-1/+1
| | | | The semantics of this are going to become a bit more subtle.
* chanmgr: tests: Introsuce new_test_abstract_chanmgrIan Jackson2022-08-161-8/+9
| | | | This is going to change. Centralise it first.
* channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-211-9/+9
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* channel padding: chanmgr: Clarify a commentIan Jackson2022-06-211-3/+3
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813574
* channel padding: Plumb settings from chanmgrIan Jackson2022-06-211-11/+35
|
* ChanMgr: Return provenance information from get_or_launchNick Mathewson2022-04-071-11/+14
| | | | | | We need this since we want to report certain conditions only when they happen on a new channel, not if we observe them on a preexisting channel.
* tor-chanmgr: Do not allocate an Internal error unless we mean it.Nick Mathewson2022-03-081-5/+5
| | | | | | | | | | | | Previously we'd allocate an error as a place-holder here, but it's not a great idea to do that with a `Bug`: each `Bug` stores a whole stack trace, which uses a whole pile of allocations to construct. Now we keep an `Option<Error>` instead. Found while heap profiling. Closes #383.
* tor-chanmgr: use Bug types.Nick Mathewson2022-02-161-4/+9
|
* Expire channels that have been unused for too longYuan Lyu2022-02-041-5/+34
|
* chanmgr: get rid of Arc around ChannelIan Jackson2022-01-131-26/+33
|
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-3/+2
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* Remove all remaining dbg! instances.Nick Mathewson2021-11-041-1/+0
|
* tor-chanmgr: remove PendingChanError as unnecessary.Nick Mathewson2021-10-281-18/+6
|
* Remove #![allow_unused] in tor_chanmgr::mgrNick Mathewson2021-10-211-1/+1
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+404
This will cause some pain for now, but now is really the best time to do this kind of thing.