aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/build.rs
Commit message (Collapse)AuthorAgeFilesLines
* Make NoLock into BadApiUsage.Nick Mathewson2022-02-221-3/+8
| | | | | | To implement this, we had to refactor the tor_circmgr api for flushing state changes to disk, so that it checks if it has the lock, and only then tries to store.
* Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-041-5/+8
| | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* errors: Drop "Error" and "Failed" from various enum variantsIan Jackson2022-02-041-1/+1
|
* tor-circmgr: Handle channel creation errors in the new styleIan Jackson2022-02-041-1/+7
|
* Untangle two needless Ok(r?) into just rIan Jackson2022-02-021-1/+1
| | | | | | Prompted by clippy::needless_question_mark. Sometimes Ok(r?) is needed to do automatic error conversion. I assume the lint checks for that. Anyway, in these cases it's not needed.
* Merge branch 'remove-type-annotation' into 'main'Nick Mathewson2022-01-071-1/+1
|\ | | | | | | | | tor-circmgr: Remove a type annotation in a method call See merge request tpo/core/arti!225
| * tor-circmgr: Remove a type annotation in a method callIan Jackson2022-01-071-1/+1
| | | | | | | | | | | | | | | | This is a method, so the resolution is automatic. It's not clear to me why this was written out this way, given that extend_ntor is right above. Signed-off-by: Ian Jackson <[email protected]>
* | De-Arc-ify Buildable for ClientCircNeel Chauhan2022-01-061-13/+6
|/
* Merge branch 'main' into 'remove_unused_rngs'eta2022-01-061-2/+1
|\ | | | | | | # Conflicts: # crates/tor-circmgr/src/build.rs
| * tor-circmgr: Don't clone parameters in create_chantarget()Neel Chauhan2021-12-251-2/+1
| |
* | Remove a bunch of unused RNGsNeel Chauhan2021-12-251-48/+22
|/
* Allow on-the-fly changing of path_rulesNick Mathewson2021-12-071-4/+9
| | | | | | | | | | | | And now the complexity begins: when the user changes the path_rules, they not only want new circuits to obey those rules: they want _all new requests_ to be put onto circuits that obey those rules. That means that when the path rules become more restrictive, we need to retire all the circuits, and make sure that currently pending circuits aren't used for any requests. If it's any comfort, doing this was even more complicated in C tor. ;)
* Sketch API for reconfiguration.Nick Mathewson2021-12-071-5/+5
| | | | | | | This patch doesn't actually make anything reconfigurable, but it does create an API that will tell you "you can't change the value of that!" If the API looks reasonable, I can start making it possible to change the values of individual items.
* add semicolons if nothing returnedDaniel Eades2021-11-251-2/+2
|
* Completely overhaul the tor-proto circuit reactoreta2021-11-121-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather like e8e9699c3c239d6c30f9ad414f15d3bad6ec03fd ("Get rid of tor-proto's ChannelImpl, and use the reactor more instead"), this admittedly rather large commit refactors the way circuits in `tor-proto` work, centralising all of the logic in one large nonblocking reactor which other things send messages into and out of, instead of having a bunch of `-Impl` types that are protected by mutexes. Congestion control becomes a lot simpler with this refactor, since the reactor can manage both stream- and circuit-level congestion control unilaterally without having to share this information with consumers, meaning we can get rid of some locks. The way streams work also changes, in order to facilitate better handling of backpressure / fairness between streams: each stream now has a set of channels to send and receive messages over, instead of sending relay cells directly onto the channel (now, the reactor pulls messages off each stream in each map, and tries to avoid doing so if it won't be able to forward them yet). Additionally, a lot of "close this circuit / stream" messages aren't required any more, since that state is simply indicated by one end of a channel going away. This should make cleanup a lot less brittle. Getting all of this to work involved writing a fair deal of intricate nonblocking code in Reactor::run_once that tries very hard to be mindful of making backpressure work correctly (and congestion control); the old code could get away with having tasks .await on things, but the new reactor can't really do this (as it'd lock the reactor up), so has to do everything in a nonblocking manner.
* Add a couple of pieces of missing documentation.Nick Mathewson2021-11-081-1/+1
|
* Replace all println/eprintln calls outside of arti CLI with trace.Nick Mathewson2021-11-041-3/+4
|
* Remove all remaining dbg! instances.Nick Mathewson2021-11-041-5/+0
|
* Get rid of tor-proto's ChannelImpl, and use the reactor more insteadeta2021-11-031-2/+4
| | | | | | | | | | | | | | | | | | | Instead of awkwardly sharing the internals of a `tor-proto` `Channel` between the reactor task and any other tasks, move most of the internals into the reactor and have other tasks communicate with the reactor via message-passing to allocate circuits and send cells. This makes a lot of things simple, and has convenient properties like not needing to wrap the `Channel` in an `Arc` (though some places in the code still do this for now). A lot of test code required tweaking in order to deal with the refactor; in fact, fixing the tests probably took longer than writing the mainline code (!). Importantly, we now use `tokio`'s `tokio::test` annotation instead of `async_test`, so that we can run things in the background (which is required to have reactors running for the circuit tests). This is an instance of #205, and also kind of #217.
* Fix clippy warnings in tests.Nick Mathewson2021-10-281-5/+5
|
* tor_circmgr: Refactor and re-enable build_timeout() testNick Mathewson2021-10-271-136/+233
| | | | | | | | | | | | | | | | | | | The previous version of this test used the old, racy version of wait_for (see #149). The new version is refactored so that simulated time is only allowed to advance after each step is done, so that we can actually be sure that each step in the process will happen as it should. In order to get the time-advances to proceed properly, and avoid polluting state between tests, I've had to introduce some machinery to encode the proper amount for time to advance. It isn't something I'd want to use for a whole bunch of tests, but for just one set, it's fine. These tests now pass reliably for me. I wonder if a discrete-event-simulation approach (hello, Shadow) would let us write tests like these to our hearts' content?
* Fix some clippy-nightly warnings.Nick Mathewson2021-10-261-0/+4
| | | | These are my fault; I merged the wrong version of !102. :p
* Merge remote-tracking branch 'origin/mr/102'Nick Mathewson2021-10-261-7/+25
|\
| * Overhaul the way WaitFor and the MockSleepProvider worketa2021-10-261-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor). The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required. (In some cases, code needed to be hacked up a bit in order to be made properly testable using these APIs; the `MockablePlan` trait included in here is somewhat unfortunate.) This should fix arti#149.
* | Finish the timeout-inference side of shared state.Nick Mathewson2021-10-201-13/+26
| |
* | Allow type of timeout estimator to change at runtime.Nick Mathewson2021-10-201-55/+52
| | | | | | | | | | | | This is a big change, but it does simplify the type of Builder a little, and isolates locking across different (potential) timeout estimator types.
* | Initial work on periodically reloading state.Nick Mathewson2021-10-191-1/+0
|/ | | | | We can use this in the case where we don't get the lock on the state file, because another process is running.
* Use better reporting for guard status.Nick Mathewson2021-10-131-9/+44
| | | | | | | | | | | | | The previous code would report all failures to build a circuit as failures of the guard. But of course that's not right: If we fail to extend to the second or third hop, that might or might not be the guard's fault. Now we use the "pending status" feature of the GuardMonitor type so that an early failure is attributed to the guard, but a later failure is attributed as "Indeterminate". Only a complete circuit is called a success. We use a new "GuardStatusHandle" type here so that we can report the status early if there is a timeout.
* Notify guard manager on network change and state flush.Nick Mathewson2021-10-101-1/+5
|
* Add a GuardMgr member to CircuitBuilderNick Mathewson2021-10-101-1/+6
|
* Use StorageHandle in tor_circmgr.Nick Mathewson2021-09-301-5/+6
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-9/+10
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+704
This will cause some pain for now, but now is really the best time to do this kind of thing.