summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/mgr.rs
Commit message (Collapse)AuthorAgeFilesLines
* circmgr: Make test helper non-async (fmt)Gabriela Moldovan2026-01-281-5/+1
|
* circmgr: Make test helper non-asyncGabriela Moldovan2026-01-281-9/+9
|
* fix: preserve timestamps when flattening RetryErrorsNihal2025-12-171-7/+1
|
* fix: use wallclock timestamps in all push_timed callsNihal2025-12-171-22/+22
|
* fix: semver labels and extend() with push_timed loopNihal2025-12-171-3/+6
|
* refactor: convert Extend to inherent method, forbid push/extend, fix ↵Nihal2025-12-171-0/+2
| | | | rend_handshake time
* refactor: clean codeNihal2025-12-171-4/+4
|
* feat(retry-error): add timestamps to retry errorsNihal2025-12-171-7/+26
|
* circmgr: Add missing docs for RestrictionFailedGabriela Moldovan2025-12-011-0/+1
|
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-2/+13
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* circmgr: report errors from update_long_lived_tunnel_last_usedNick Mathewson2025-11-121-21/+54
| | | | | (The only error possible is an internal error from calling it with a non-long-lived tunnel.)
* circmgr: In expiration task, try again if we are not yet ready to expire.Nick Mathewson2025-11-121-21/+31
|
* circmgr: Add a timeout setting for long-lived circuits.Nick Mathewson2025-11-121-1/+2
|
* circmgr: Implement expiration for long-lived tunnels.Nick Mathewson2025-11-121-21/+217
| | | | | | | | | | | | | | | | | This code uses the algorithm of prop368: When a tunnel is sufficiently isolated, we want to expire it after it has been disused for a certain amount of time. The implementation is a little tricky, since we need to call an async function on ClientTunnel to look up the disused_since() check. We don't want to call async functions while holding locks, so we need to drop the TunnelList lock before we do the disused_since() calls, and the grab it again. As part of this change, I've had made expiration functions return the earliest time at which any tunnel might expire. We can use this in the future to spawn fewer expiration tasks, and scan the list of tunnels less often.
* circmgr: Add a notion of long-lived tunnels.Nick Mathewson2025-11-121-8/+45
|
* circmgr: Refactor should_expire()Nick Mathewson2025-11-121-24/+40
| | | | | Instead of a series of cutoffs, take an object with a set of lifetimes.
* circmgr: make expiration functions asyncNick Mathewson2025-11-121-23/+18
| | | | We'll need them to be async so they can call disused_since() on tunnels.
* circmgr: rename expire_tunnel to consider_expiring_tunnelNick Mathewson2025-11-121-3/+7
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* all: run cargo fmtSteven Engler2025-11-041-1/+1
|
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* Move `FallbackDir` into `tor-dircommon`Clara Engler2025-09-111-1/+1
|
* proto: Add a circuit module shared between client and relay impls.Gabriela Moldovan2025-08-281-1/+2
| | | | | | | This is just code motion (I suggest reviewing with `--color-moved`). This also moves the implementation-agnostic parts from `tor_proto::client::circuit` to a new `tor_proto::circuit` module.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-9/+5
| | | | | | | | | | | | | | 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.
* conflux: Adjust docs and fix doc links.Gabriela Moldovan2025-08-051-12/+12
|
* proto: abolish path_ref() in favor of all_paths().Gabriela Moldovan2025-08-051-6/+3
| | | | | | | | | | | | | Until now, we've been using `ClientCirc::path_ref()` to get the *only* path of a circuit. Now that `ClientCirc` is a handle to a tunnel reactor (which may or may not be multi-path), we need to decide for each call site of `path_ref()`, if we actually want *all* paths in the tunnel, or if we expect the tunnel to be single-path and thus want the *only* path in the tunnel. I've added two new APIs to address this: `all_paths()`, for getting all the paths in the tunnel, and `single_path()` for getting the only path in the tunnel, or an error if the tunnel is single-path.
* circmgr: Add back cognitive_complexity allows.Gabriela Moldovan2025-08-051-0/+1
| | | | | These were removed somewhere along the way (which is now causing the clippy checks to fail).
* circmgr: Fix unit testsDavid Goulet2025-08-051-12/+12
| | | | Signed-off-by: David Goulet <[email protected]>
* hs: Use the new Tunnel interface for onion serviceDavid Goulet2025-08-051-1/+1
|
* tunnel: Implement Buildable for ClientTunnelDavid Goulet2025-08-051-10/+7
| | | | | | | | | | | | In order to pull this off, the Arc requirement needs to go away because the Arc<ClientCirc> is now within the ClientTunnel. This commit also has a rename of the CircuitBuilder to TunnelBuilder in order to reflect the change that it now builds a ClientTunnel. There is a slight rename in tor-proto as well just for accuracy. Signed-off-by: David Goulet <[email protected]>
* circmgr: Major rename for the new Tunnel namespaceDavid Goulet2025-08-051-446/+457
| | | | | | | | | | | | The CircMgr will no longer yield circuits but tunnels (src/tunnel.rs). This is a first step to rename most circuit related objects to use "tunnel" instead. Some "circuit" names have been kept for more precise definitions. No behavior changes. Signed-off-by: David Goulet <[email protected]>
* tor-circmgr: Reduced dependency on `once_cell`hashcatHitman2025-06-141-2/+2
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* tor-circmgr: fix docs failureSteven Engler2025-06-091-2/+2
|
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+2
| | | | | | | | | | | | | Apparently clippy nightly is better (or worse?) about detecting complex functions than before, so I'm suppressing these warnings where they occur. I have mixed feelings about these warnings: On the plus side, they really do help to detect functions that are twistier than they need to be. On the minus side, they get confused by tracing macros, and the "allows" do pile up. But on the plus side, those "allows" do provide a way to find functions that need to be refactored, and they are never uglier than the functions they decorate.
* tor-proto: Update the TunnelMutableState when a circuit is removed.Gabriela Moldovan2025-05-151-2/+6
| | | | | | | | This is messy, because `ClientCirc::{path_ref, n_hops, ..}` become fallible (we can't unwrap the result, because when a circuit is closed, its state gets removed from the `TunnelSharedState`, but its `ClientCirc` handle continues to exist, so any attempt to retrieve the state will result in an `Err`).
* circmgr: Rename AbstractCirc::{extend_ntor => extend}Nick Mathewson2025-04-281-2/+2
| | | | | We don't want to be thinking about ntor vs ntor3 in circmgr.
* circ: Remove CircParameters reference in call stackDavid Goulet2025-04-231-1/+1
| | | | | | | | | | | This avoids cloning the object and instead allows us to have a CircParameters per hop on the circuit path. This will come handy with congestion control where each hop might have different congestion control parameters. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - Several methods have been moved out of SliceRandom.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-3/+3
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-rtmock: allow-Decorate every use of MockSleepProviderIan Jackson2025-03-061-1/+16
| | | | | | | MockSleepProvider and MockSleepRuntime have been declared deprecated by the docs for some time. We're about to mark them `#[deprecated]`. This commit has been split out for clarity of review.
* Resolve clippy::empty_line_after_doc_comments warnings.Nick Mathewson2024-12-031-1/+2
| | | | These are new in Rust 1.83.
* Introduce mpsc_channel_no_memquota and use it in the places it's wantedIan Jackson2024-10-151-1/+6
| | | | | These are the call sites where using this fucntion is correct. (Outside tor-rtmock, which we'll do separately.)
* Merge branch 'div_ceil' into 'main'Nick Mathewson2024-10-031-14/+1
|\ | | | | | | | | Use {u64,usize}::div_ceil See merge request tpo/core/arti!2473
| * Use {u64,usize}::div_ceilNick Mathewson2024-09-301-14/+1
| | | | | | | | | | Previously we had to avoid it, but now that our MSRV is above 1.73 we can use it with abandon.
* | CircMgr: Start writing tests.Wesley Aptekar-Cassels2024-10-031-12/+35
|/
* CircMgr: Make CircMgr and HsCircPool generic over builder type.Wesley Aptekar-Cassels2024-09-241-244/+121
| | | | | | | | | | This will allow for testing, as the CircuitBuilder can be replaced with a mocked version. This did require moving some of what was in the CircuitBuilder impl into the AbstractCircuitBuilder type, since Drop implementations can't be specialized, but that's fine, as we'll probably be doing more of that in the future anyways.
* Add test for CircList::find_open.Wesley Aptekar-Cassels2024-09-161-1/+55
| | | | | | | This tests that when requesting preemptive circuits, they are not given out when a insufficient number of circuits are in the CircList, but that they are given out once the required number of circuits has been reached.
* tor-circmgr: Remove AbstractSpec and FakeSpec.Wesley Aptekar-Cassels2024-09-161-241/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AbstractSpec and FakeSpec actually make testing more difficult, since they prevent using FakeBuilder in code that relies on the concrete TargetCircUsage and SupportedCircUsage types. Removing them means FakeBuilder can be used in more places, and also means that the test code is closer to the real code, since TargetCircUsage and SupportedCircUsage are now exercised directly in more tests. This did require making one change to a test, which I think was previously testing behaviour that was true for FakeSpec but not for the real code: The mgr::test::isolated test previously asserted that, in the case where three circuits were requested, two with isolation and one without, the non-isolated circuit would be shared with one of the isolated circuits. This was allowed by the FakeSpec::supports function. However, in the actual code, the path is as follows: * AbstractCircMgr::get_or_launch * AbstractCircMgr::prepare_action * CircList::find_open * AbstractSpec::find_supported * abstract_spec_find_supported * OpenEntry::supports * SupportedCircUsage::supports * StreamIsolation::compatible_same_type StreamIsolation::compatible_same_type checks owner_type, which is always zero for non-isolated streams and always non-zero for isolated streams, meaning that a isolated stream will never be compatible with a non-isolated stream. The seems like desirable behaviour, so I simply modified the test to make four connections, two isolated and two not, and checked that the isolated streams never share any circuits, and that the two non-isolated streams use the same circuit. As far as I can tell, this is the intended behaviour in the existing code.
* 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.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|