summaryrefslogtreecommitdiff
path: root/crates/tor-hsclient/src/state.rs
Commit message (Collapse)AuthorAgeFilesLines
* Run cargo +nightly fmt to format many let ... else ...Ian Jackson2023-07-241-17/+21
| | | | | | | | | | | rustfmt has grown opinions about how let ... else ... ought to be formatted. They don't always agree with our previous manual decisions. I think our policy is to always insist on rustfmt. When that version of rustfmt hits stable, our CI will start to fail for everyone. (Right now this discrepancy just causes trouble for contributors who are using nightly by default.)
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-13/+19
| | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.
* tor-hsclient: Abolish ad-hoc real-world-time sleepsIan Jackson2023-07-061-12/+4
| | | | | | Now we can reliably wait precisely for the tasks to be all waiting. This test case no longer involves any real executor.
* tor-hsclient: Reimplement Debug for MockCircIan Jackson2023-06-291-15/+12
| | | | | This is less code. Also it now dumps the connect_called field which was introduced in the meantime.
* HS configuration: Plumb configuration through (fmt)Ian Jackson2023-06-281-8/+14
| | | | Apply deferred rustfmt churn.
* HS configuration: Plumb configuration throughIan Jackson2023-06-281-1/+45
| | | | | Invent a trait a la circmgr config for the hs client connector config. Plumb a suitable value all the way through to the code that will use it.
* tor-hsclient: Increase some timeoutsIan Jackson2023-06-261-2/+2
| | | | | | | | | | | 1. Fix a use of 10ms that should have been TIMEOUT_SLOP. 2. Increase BODGE_YIELD by a factor of 5. Now this test should tolerate being hung up for 125ms. I am hoping that this will fix the CI failure https://gitlab.torproject.org/Diziet/arti/-/jobs/302457 which fails at the line comparing circuit1 with circuit2a. (I can't repro that locally.)
* tor-hsclient: test: Introduce some constants for timingsIan Jackson2023-06-261-5/+16
|
* tor-hsclient: test: Add another sleep for expiry task *start*Ian Jackson2023-06-261-0/+2
| | | | | | | Without this, the expiry task can end up choosing a 600s timeout starting *after we advanced the clock*. Fixes #923
* tor-hsclient: impl Debug by hand for MockCircIan Jackson2023-06-261-1/+18
| | | | | | | | The provided impl for Mutex is hopeless: it prints just some internal flags and doesn't acquire the mutex for printing purposes. At some point we might want to factor this out as a general function on `Arc<Mutex<...>>` but not now.
* Merge branch 'data' into 'main'Ian Jackson2023-06-261-8/+63
|\ | | | | | | | | tor-hsclient: Expire old IPT and HS descriptor data eventually See merge request tpo/core/arti!1290
| * tor-hsclient: Split out expire_old_data functionIan Jackson2023-06-261-0/+5
| | | | | | | | | | As per discussion in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915679
| * tor-hsclient: Add a TODO SPEC re data lifetimeIan Jackson2023-06-231-0/+2
| |
| * tor-hsclient: state tests: Test housekeeping (data expiry)Ian Jackson2023-06-231-0/+5
| |
| * tor-hsclient: state tests: Promote mk_hsconn callIan Jackson2023-06-231-1/+3
| |
| * tor-hsclient: state tests: Introduce connect_calledIan Jackson2023-06-231-5/+11
| | | | | | | | This will allow us to track when `Data` is discarded.
| * tor-hsclient: Expire old data eventuallyIan Jackson2023-06-231-2/+37
| | | | | | | | Otherwise we'll fill up our RAM with junk.
* | tor-hsclient: Add a TODO SPEC re circuit dirtinessIan Jackson2023-06-231-0/+2
|/
* tor-hsclient: Add a note about circuit expiry uncertainty, ticketIan Jackson2023-06-221-0/+3
|
* tor-hsclient: Expand explanation of `last_used` (for Open)Ian Jackson2023-06-221-1/+20
|
* tor-hsclient: Make comment about circuit expiry more accurateNick Mathewson2023-06-221-1/+2
|
* tor-hsclient: Apply broken formatting as demanded by rustfmtIan Jackson2023-06-221-1/+1
|
* tor-hsclient: Test circuit expiryIan Jackson2023-06-221-1/+46
|
* tor-hsclient: Expire HS circuits that we don't want to reuseIan Jackson2023-06-221-4/+128
|
* tor-hsclient: Introduce helper function for locking services tableIan Jackson2023-06-221-12/+3
|
* tor-hsclient: Abolish an obsolete commentIan Jackson2023-06-221-1/+0
| | | | | | We don't now handle inability to store by panicking. Like the previous comment says, such situations end up with Err in stored, and that's handled by logging, below.
* tor-hsclient: Apply deferred clippy churn needed by fmt churnIan Jackson2023-06-211-1/+1
| | | | rustfmt *introduced* this clippy warning.
* tor-hsclient: Apply deferred rustfmt churnIan Jackson2023-06-211-5/+3
|
* tor-hsclient: Add HSID to some log messagesIan Jackson2023-06-211-6/+7
| | | | | For the debug!, we can use the unredacted form. For error!, we use Sensitive.
* netdoc, hsclient: Update remaining ed25519::SecretKey usersNick Mathewson2023-05-181-2/+4
| | | | | | Fortunately, these are all in experimental code. Closes #798
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-8/+8
| | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* Run rustfmtIan Jackson2023-03-301-13/+14
| | | | Apply this churn, which I deferred for ease of review.
* tor-hsconn: Rename ConnError (from HsClientConnError)Ian Jackson2023-03-301-11/+11
| | | | | The old name was unwieldy and other crates can just as well name it by the crate scope.
* tor-client: Pass a netdir for each requestIan Jackson2023-03-301-5/+12
| | | | | This will be more convenient inside tor-hsclient. In arti-client, this mirrors the way TorClient::get_or_launch_exit_circ works.
* Pass HS identity to hsclient connection functionIan Jackson2023-03-281-1/+6
| | | | Obviously it will need this!
* Pass HsCircPool to hsclient connect function, not CircMgrIan Jackson2023-03-281-1/+2
| | | | | We separated this out in the circmgr API. This is what the HS client needs. It doesn't want to participate in the general circuit pool.
* Fix typosDimitris Apostolou2023-03-031-3/+3
|
* hsclient state: Rename rechecks (from attempts) and add clarifying docsIan Jackson2023-03-011-9/+22
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2882079
* hsclient state: Implement and test MultikeyIsolatedMap::retainIan Jackson2023-03-011-2/+3
|
* hsclient state: Split off MultikeyIsolatedMapIan Jackson2023-03-011-82/+16
|
* hsclient state: Move all the data fields into the tableIan Jackson2023-03-011-28/+37
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881576 This is a singificant simplification, in fact.
* hsclient: Document sharing rulesIan Jackson2023-03-011-0/+11
| | | | | Text largely from https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881638
* hsclient state: rustfmtIan Jackson2023-03-011-241/+244
| | | | | | Autogenerated with rustfmt; no code changes. This tidies up the bizarre formatting.
* hsclient state: Lots more doc comments about barriers, structure, etc.Ian Jackson2023-03-011-2/+74
|
* hsclient state: Break `obtain` out into a fnIan Jackson2023-03-011-61/+82
| | | | | | | | | | This is getting rather confusing; simply reformtting it won't do, I think. Also there would be much rightward drift. So move the meat out into the new function. (And introduce a convenience alias for its captures.) Docs and reformatting will follow in a moment.
* hsclient state: Restructure using a scope to drop the mutex guardIan Jackson2023-03-011-20/+44
| | | | | | | | | | | | Explicit drops don't work. Instead, introduce a scope. We need two scopes, actually: one where we do the initial table wrangling, and one for the retries after relock. So we must put the meat in a closure so we can reuse it. And we must return the flow control as an enum. Bah, etc. Avoid reformatting this for the moment. This makes the delta legible...
* hsclient state: Break out ServiceState::blankIan Jackson2023-03-011-5/+12
| | | | | We're going to have another function which will want this. Leave a convenience closure to capture the runtime.
* hsclient state: Move error inspection before guard re-lock.Ian Jackson2023-03-011-4/+5
| | | | | | This is still correct from a lock hierarchy pov. It moves the guard relock to the end, which is going to be necessary since it is going to have to move right outside the loop.
* hsclient keys: Fix non-equal keys test to provide a (dummy) key (fmt)Ian Jackson2023-03-011-1/+4
|