summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/timeouts
Commit message (Collapse)AuthorAgeFilesLines
* Resolve clippy warnings from 1.83Nick Mathewson2025-05-131-2/+1
| | | | | Now that our MSRV is 1.83, clippy is happy to make more recommendations for us.
* tor-circmgr: Explicit type annotationClara Engler2025-03-261-1/+1
| | | | | | | This commit adds an explicit type annotation to the learning_timeouts() function, as leaving it out yielded an error while trying to compile tor-circmgr in a project that had this crate deep down in its supply chain.
* circmgr: test behavior of IteratorRandom::choose_multipleNick Mathewson2025-03-251-1/+15
|
* Merge branch 'timeout_est_overflow' into 'main'Nick Mathewson2025-03-191-3/+11
|\ | | | | | | | | | | | | Impose a maximum on our fallback estimated timeout Closes #1693 See merge request tpo/core/arti!2842
| * Impose a maximum on our fallback estimated timeoutNick Mathewson2025-03-061-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallback timeout is the one that we use when we have insufficient data. We reset our observations, and maybe rebuild our circuits, when we find that too many circuits have failed recently. When we do so, we double our fallback timeout. Previously we had no limit, which could lead to overflow (#1693). In this commit we impose a maximum of 2 hours, which is ridiculously high. (C tor uses a maximum of INT32_MAX seconds, which is even more ridiculously high.) Closes #1693.
* | squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
|/ | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-circmgr: Add trace log on circuit build timeout.Wesley Aptekar-Cassels2025-01-081-0/+2
| | | | This may help debugging #1792.
* Run maint/add_warning.Nick Mathewson2024-03-132-0/+2
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-232-0/+2
|
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-112-0/+2
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396
| * Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-102-0/+2
| |
* | rng ranges: Use gen_range_infallible() for Duration::ZERO..=TIan Jackson2023-07-101-1/+1
| |
* | rng ranges: Use gen_range_checked().unwrap() in test caseIan Jackson2023-07-101-2/+2
|/ | | | | | Ideally we would be allowed to use vanilla gen_range() here, but there doesn't seem to be a way to allow a specific clippy-forbidden method using #[allow] and we probably don't want to make a blanket allow.
* circmgr: Use event_report!() and similar macrosNick Mathewson2023-07-071-2/+2
| | | | This simplifies our logging a little, and implements part of
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-1/+0
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* Use ErrorReport for errors in warn! in tor-circmgrIan Jackson2023-01-301-1/+2
|
* 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.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-122-0/+16
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* Fix grammar and typosSamanta Navarro2022-04-271-1/+1
|
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-252-2/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* Add TODOs on uncertain points about time_since_last_trafficNick Mathewson2022-02-091-0/+1
| | | | | | This edge-case was there even before the migration of 595fe1ab881b94106649, but now it's more explicit and ought to be revisited.
* Remove the use of Mutex in channel unused_since timestampYuan Lyu2022-02-081-2/+6
|
* Only count timeouts when we've seen net activity.Nick Mathewson2021-12-201-5/+7
| | | | | | | This closes arti#256. It makes our behavior match Tor's more closely, though it has a simpler implementation than Tor. I think that the extra complexity in Tor's logic is because we used to record timeouts in the histogram as well as in the success/failure log.
* fix nightly clippy errorsTrinity Pointard2021-12-091-2/+1
|
* Use a safer histogram rebuild algorithm.Nick Mathewson2021-12-081-9/+14
| | | | | Our old algorithm could, on some inputs, exhaust RAM. That's not great, since we try to be robust againt corruption to the state file.
* Change an XXX in pareto.rs: a ticket is now open.Nick Mathewson2021-12-081-2/+3
|
* Use a panic-free function to multiply timeouts.Nick Mathewson2021-12-063-7/+10
| | | | | | | | | Previously we used Duration::mul_f64, which panics if its output is out-of-range. That shouldn't actually be possible for the values we're giving it, but probably it's better to just multiply in a safe way. This resolves a couple of XXXXs and therefore relates to #231.
* add semicolons if nothing returnedDaniel Eades2021-11-252-3/+3
|
* Fix a few typos.Nick Mathewson2021-11-241-1/+1
| | | | Also fix some commonwealth spellings that had slipped in.
* Basic tests for readonly estimators, and estimator migration.Nick Mathewson2021-11-032-2/+92
| | | | | Also add a comment about a possible problem behavior in read-only estimators.
* Add #[serde(flatten)] HashMap fields to serializable objectseta2021-10-271-2/+8
| | | | | | | | | | As per arti#175, we'd like to be able to handle newer Arti versions storing additional state in the persisted state files, without dropping this data on the floor when we write out changes to these files. Use the #[serde(flatten)] mechanism to achieve this, by adding catch-all HashMap<String, JsonValue> fields to all structs that are at risk of this happening to them.
* Remove #![allow(dead_code)] in timeouts.rsNick Mathewson2021-10-211-0/+1
|
* Finish the timeout-inference side of shared state.Nick Mathewson2021-10-201-2/+63
|
* Add a timeout estimator to take estimates from another process.Nick Mathewson2021-10-203-42/+92
|
* Allow type of timeout estimator to change at runtime.Nick Mathewson2021-10-202-143/+221
| | | | | | This is a big change, but it does simplify the type of Builder a little, and isolates locking across different (potential) timeout estimator types.
* enable checked_conversions lint.Nick Mathewson2021-10-091-4/+10
|
* Initial backend implementation for guard node manager.Nick Mathewson2021-10-071-0/+1
| | | | | | | There are some missing parts here (like persistence and tests) and some incorrect parts (I am 90% sure that the "exploratory circuit" flag is bogus). Also it is not integrated with the circuit manager code.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+2
|
* More tests in pareto.rsNick Mathewson2021-09-081-9/+47
|
* Use same defaults for abandon and close times in timeout code.Nick Mathewson2021-09-071-6/+4
| | | | | | | | | | | On torspec!40, Mike says: I don't think there is a practical difference here. As per Section 2.4.5, if 60 seconds is not enough and causes the liveness test to fail due to too many timeouts, we will double the initial timeout. This makes our behavior the same as C tor.
* Stop making abandoned/successful circuit counts persistentNick Mathewson2021-09-071-22/+1
| | | | | | | | | | | | | | The C Tor implementation doesn't do this, and Mike says: I think it is a reasonable enough assumption that if Tor has restarted, this kind data is no longer fresh enough to be accurate for this purpose. This is also only 20 circuits here, and typical timeouts are now around 1-2 seconds or less.. So a restarted client with a timeout that is too low for a new internet connection will figure this out pretty quickly. I think that is OK. (from torspec!40)
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+941
This will cause some pain for now, but now is really the best time to do this kind of thing.