Commit Graph

2646 Commits

Author SHA1 Message Date
Nick Mathewson 4c08141488 Clarify state vs cache in ErrorKind 2022-02-17 12:35:35 -05:00
Nick Mathewson 024ec61a1a Correct ErrorKinds for some tor-dirclient errors. 2022-02-17 12:26:18 -05:00
Nick Mathewson de86ac0b0f Rename CircuitTimeout to TorNetworkTimeout. 2022-02-17 12:22:51 -05:00
Nick Mathewson 034c5ba9f5 Rename ExitTimeout to RemoteNetworkTimeout. 2022-02-17 12:19:33 -05:00
Nick Mathewson 4db586cf00 tor_circmgr::Error: Sort variants by interesting-ness.
We can't use discriminants here now, but maybe we can in the future.
2022-02-17 12:12:04 -05:00
Nick Mathewson 550eb9e61b Tweak documentation on ErrorKind::Transient 2022-02-17 11:50:42 -05:00
eta a772d02578 Merge branch 'issue-325' into 'main'
Make CircMap open_ent_count O(1)

See merge request tpo/core/arti!302
2022-02-17 14:36:19 +00:00
Ian Jackson ce6fbac0d7 Merge branch 'bootstrap_second' into 'main'
arti: create TorClient first, then bootstrap.

Closes #336

See merge request tpo/core/arti!320
2022-02-17 14:21:04 +00:00
Ian Jackson 516a2a3de8 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!326
2022-02-17 14:19:08 +00:00
Ian Jackson c9aa3b9937 tor-dirmgr: Use Bug type for sqlite-detected bugs
So we get a stack trace
2022-02-17 13:32:47 +00:00
Ian Jackson 1a9a209771 tor-dirmgr: Make sqlite_error_kind take rusqlite::Error
We're about to reuse this and we'll want it to take the higher-level
type.  Also it seems more proper like this.
2022-02-17 13:31:36 +00:00
Ian Jackson 9a6518fb81 tor-error: splitting/lumping guidelines 2022-02-17 13:31:11 +00:00
Ian Jackson 9a55290037 tor-dirclient: Error::HttpError: add a TODO saying to abolish 2022-02-17 13:31:11 +00:00
Ian Jackson 079f7fd1b8 ErrorKind::RemoteRefused: Expand on description, narrowing scope 2022-02-17 13:31:11 +00:00
Ian Jackson cca253ff9f ErrorKind::Csnceled: Expand on description 2022-02-17 13:31:11 +00:00
Ian Jackson 48e3ae6b79 ErrorKind::CircuitTimeout: Expand on description 2022-02-17 13:31:11 +00:00
Ian Jackson de70e15f21 ErrorKind::DirectoryExpired: Add possible deprecation notes 2022-02-17 13:31:11 +00:00
Ian Jackson 2d4901ccde tor-circmgr: errors: Use autoconversion for Bug 2022-02-17 13:31:03 +00:00
Ian Jackson bbcc871105 Remove some needless refs and slicing
Prompted by nightly's clippy (which has some false positives, so is
currently disabled).
2022-02-17 11:16:27 +00:00
Ian Jackson 094ddd7cd7 Add a comment about "&mut [&mut ]" 2022-02-17 11:07:52 +00:00
Ian Jackson 95e081ab44 Merge branch 'ptr_arg_fix' into 'main'
Re-enable clippy::ptr_arg where it had been disabled.

See merge request tpo/core/arti!323
2022-02-17 11:07:45 +00:00
Dimitris Apostolou ea929fd942
Fix typos 2022-02-17 12:55:59 +02:00
Yuan Lyu 7ab840785e Replace as_mut with deref impl for MutCircEnt 2022-02-16 17:23:16 -05:00
Yuan Lyu cc7023fb75 Make CircMap open_ent_count O(1) 2022-02-16 16:48:49 -05:00
Nick Mathewson 36314ad364 tor_error: a couple of spelling/formatting issues 2022-02-16 16:43:13 -05:00
Nick Mathewson 990753ca92 Finally remove ErrorKind::TODO.
Closes #322.
2022-02-16 16:40:57 -05:00
Nick Mathewson 0bdef96897 arti_client: provide Kinds for all errors. 2022-02-16 16:38:22 -05:00
Nick Mathewson 2a7087ff93 dirmgr: Remember where netdocs came from.
This isn't complete (see TODO), but it's enough to let us report the
right ErrorKind if something fails to parse.
2022-02-16 16:28:23 -05:00
Nick Mathewson 4bb7c97399 dirmgr: eliminate StringParsingError.
It had too many possible Kinds depending on what kind of string had
failed to parse.

I decided to use #[source] here instead of #[from], so that we
would have to explicitly convert these errors where they show up.
2022-02-16 16:02:28 -05:00
Nick Mathewson f71473cf73 dirmgr: HasKind for internal and sqlite errors
At first I had thought that all sqlite errors would be internal, but that's
not the case.
2022-02-16 15:48:24 -05:00
Nick Mathewson 9e03643f65 dirmgr: implement HasKind for the easier variants 2022-02-16 15:22:21 -05:00
eta 30439f9dc2 Merge branch 'eta/lazy-init' into 'main'
arti-client: add ability to automatically bootstrap

Closes #278

See merge request tpo/core/arti!322
2022-02-16 20:08:38 +00:00
Nick Mathewson 49c87fa8f9 Implement HasKind for tor_dirclient::Error 2022-02-16 14:53:58 -05:00
Nick Mathewson 7f9bbcb437 dirclient: remove an unused error type. 2022-02-16 14:42:07 -05:00
Nick Mathewson 543916e812 Clarify and rename PendingCanceled
From its old name, this error had implied that we were giving no
useful information when we were waiting on a pending cirucit request
that failed.  In fact, this error would only happen if we dropped the
`mpsc::Sender` for a circuit attempt without reporting success or
failure.
2022-02-16 14:35:06 -05:00
Nick Mathewson 1d773e748f Provide a better ErrorKind from RetryError.
(Instead of reporting the _last_ error, report the _worst_ error.)
2022-02-16 14:35:06 -05:00
Nick Mathewson c1899f787b circmgr: Add a Kind for speculative guard failure.
These errors should almost never be seen by the user; we should instead
retry the circuit.  But they _can_ be seen by the use if selecting a
guard takes too long, or too many attempts. (Therefore, they aren't true
"internal" errors.)

I suspect that we might not want to keep this TransientFailure kind, but
I'm not sure what else to do here for now.
2022-02-16 14:35:06 -05:00
Nick Mathewson 96d856e264 Add kinds for *most* circmgr errors.
There are a couple of tricky ones I'll do separately.
2022-02-16 14:35:06 -05:00
Nick Mathewson 900007585a circmgr: Port InternalError to use Bug. 2022-02-16 14:35:06 -05:00
Nick Mathewson f572baa7ad Merge branch 'chanmgr-error' into 'main'
Implement HasKind for tor-chanmgr::Error

See merge request tpo/core/arti!324
2022-02-16 19:34:42 +00:00
eta 790ea4af4b arti-client: add ability to automatically bootstrap
The new `BootstrapBehavior` enum controls whether an unbootstrapped
`TorClient` will bootstrap itself automatically (`Ondemand`) when an
attempt is made to use it, or whether the user must perform
bootstrapping themselves (`Manual`).

The `lazy-init` example shows how you could write a simple
`get_tor_client()` function that used a global `OnceCell` to share
a Tor client across an entire application with this API.

closes arti#278
2022-02-16 19:29:16 +00:00
Ian Jackson 716a060191 Merge branch 'netdir-error' into 'main'
Simplify tor-netdir::Error by a *lot*

See merge request tpo/core/arti!319
2022-02-16 17:52:52 +00:00
Nick Mathewson caa70fde35 tor-chanmgr: use Bug types. 2022-02-16 11:55:47 -05:00
Nick Mathewson 10bca35bba Implement HasKind for tor-chanmgr::Error
(There will be a folowup to work on internal errors here.)
2022-02-16 11:55:47 -05:00
Nick Mathewson 2147d0849f Merge branch 'cell-proto-error' into 'main'
tor-cell and tor-proto: provide HasKind.

See merge request tpo/core/arti!304
2022-02-16 16:55:14 +00:00
Nick Mathewson ed57157d84 Re-enable clippy::ptr_arg where it had been disabled.
In one of the two places, nightly no longer warns.  In the other
place, it's fine for nightly to warn: I just fixed the code to take
a slice instead.

Partial revert of 856aca8791.

Resolves part of #310.
2022-02-16 11:33:12 -05:00
Nick Mathewson 62a62b6dfd tor_proto::Error: Fix an incomplete sentence. 2022-02-16 11:09:59 -05:00
eta 967f0a45f3 Merge branch 'ticket_344' into 'main'
Refactor tor-netdoc a bit more, to use Bug right.

See merge request tpo/core/arti!316
2022-02-16 15:21:11 +00:00
Nick Mathewson c06bee8a11 Merge branch 'issue-320' into 'main'
Move persistent state flush from client to circmgr

See merge request tpo/core/arti!321
2022-02-16 13:56:34 +00:00
Yuan Lyu 98b1a5a279 Move persistent state flush from client to circmgr 2022-02-15 20:04:45 -05:00