summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/build.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.