Commit Graph

2651 Commits

Author SHA1 Message Date
Nick Mathewson 784f1531bb Make NoLock into BadApiUsage.
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.
2022-02-22 16:13:37 -05:00
Nick Mathewson a2e2663e90 Eliminate RequestedResourceAbsent kind.
There was only one use of this, and it was in as-yet-unused relay-only
code.

Removing this type required refactoring the relay onion handshake code
to use its own error type, which is probably clever anyway.
2022-02-22 16:00:25 -05:00
Nick Mathewson 789e6c87b8 Fold NamespaceFull into BadApiUsage. 2022-02-22 15:44:49 -05:00
Nick Mathewson 4cedc1a190 Rename RemoteNameError to RemoteHostNotFound
This is a bit ugly but we need it to work around the problem where
exits aren't always clear about _why_ a hostname lookup failed.
2022-02-22 15:43:27 -05:00
Nick Mathewson 0ce4a12976 Replace TorNetworkError with TorDirectoryError
This is still not as specific as we want; but there's already a TODO
comment in tor-dirclient::err about fixing that at some point in the
future.
2022-02-22 15:41:01 -05:00
Nick Mathewson 7d4a57d5fa Rename TorConnectionFailed to TorAccessFailed 2022-02-22 15:38:13 -05:00
Nick Mathewson 3f0d50e08f Fold UnexplainedTaskSpawnFailure into Internal. 2022-02-22 15:37:22 -05:00
Nick Mathewson 0e242831b2 Rename TorShuttingDown to ArtiShuttingDown 2022-02-22 15:36:09 -05:00
Nick Mathewson 0d079071fe Replace RemoteRefused with CircuitRefused.
Also document that it's a lower-level error kind.
2022-02-22 15:34:46 -05:00
Nick Mathewson f018d0c74b Rename RemoteIdMismatch to RelayIdMismatch. 2022-02-22 15:32:08 -05:00
Nick Mathewson 04ca1f662f Fold EK::Canceled into TransientFailure
Also add some TODO comments in circmgr for future work.
2022-02-22 15:30:12 -05:00
Nick Mathewson 5351aaa308 Fold AlreadyClosed into BadApiUsage 2022-02-22 15:25:24 -05:00
Nick Mathewson a02737be1c Add TODOs for errorkinds we mean to fix later
Per #348, These are the cases that we meant to fix down the road, but
not in 0.1.0.
2022-02-22 15:22:49 -05:00
trinity-1686a 6ce6e400c7 add script for coverage on fuzzing 2022-02-22 20:45:55 +01:00
trinity-1686a 74e3f26b88 use libfuzz capabilities instead of scripting 2022-02-22 20:45:55 +01:00
Nick Mathewson e62afdf79a Merge remote-tracking branch 'origin/mr/335' 2022-02-22 12:46:51 -05:00
Nick Mathewson 4d4c7f47a7 Merge branch 'error-report' into 'main'
Improve error messages from arti cli

See merge request tpo/core/arti!331
2022-02-22 17:31:18 +00:00
Ian Jackson be2bb0ccfb tor_error::Report: add tests 2022-02-22 14:57:16 +00:00
Ian Jackson 01c5e07087 tor_error::Report: Add bound to struct
This is more typing in the definition but it produces much better
error messages if you try to Report(foo).to_string()
2022-02-22 14:53:17 +00:00
Ian Jackson 06964bbfbb Move program name printing to report_and_exit 2022-02-22 14:52:47 +00:00
Ian Jackson d1f4e9f3c6 Merge branch 'pending_error' into 'main'
Handle panics from circuit construction

Closes #347

See merge request tpo/core/arti!336
2022-02-22 10:58:09 +00:00
Nick Mathewson dd55f5ce2d Remove clippy::needless_borrow exception in CI.
This exception is no longer necessary now that the underlying CI bug
is fixed.
2022-02-20 09:09:38 -05:00
Nick Mathewson c910226b55 Make a TorClientBuilder API.
This is a defensive API choice to protect against the possibility
that we'll want to add a bunch of other non-config options in
the future.

Closes #350
2022-02-18 15:28:31 -05:00
Nick Mathewson 3ff9b187ea Handle panics from circuit construction.
We handle them by reporting them to task that's waiting for the
circuit, then relaying the panic.

Doing so allows the waiting task to distinguish panics
(EK::Internal) from cases where the reactor dropped the task
entirely (EK::ReactorShuttingDown).  And doing _that_ removes one
case of EK::Canceled, which helps us on our goals towards #348.

Closes #347.
2022-02-18 14:22:38 -05:00
Ian Jackson 7d403b42fe Placate clippy on nightly, properly
I c&p this lint suppression but from a cli option printed by clippy,
and I didn't notice the need to change the - to _.
2022-02-18 18:07:43 +00:00
Nick Mathewson 0513a1d8a6 Edit tor-error comment to reflect shared ideas 2022-02-18 12:51:05 -05:00
Ian Jackson 4182c30b63 Placate clippy on nightly 2022-02-18 17:37:21 +00:00
Ian Jackson f9d2ecad27 Bump anyhow minimal version to 1.0.23
This is the first one where anyhow::Error impl AsRef<dyn StdError>

We want this because we want to add error reporting functionality
which works with all kinds of errors, which means we need an
anyhow::Error which can be vieweed as a StdError.

(The alternative would be to deref at the call sites of
report_and_exit, making it less ergonomic.)

anyhow 1.0.23 is from November 2019.
2022-02-18 17:04:57 +00:00
eta b4c0bd6ef3 Merge branch 'proxy-sooner' into 'main'
arti cli: socks proxy: Start listening immedately

See merge request tpo/core/arti!333
2022-02-18 16:06:08 +00:00
eta 7f1ac07baf Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!332
2022-02-18 15:05:11 +00:00
Ian Jackson 59fb3a6040 tests/chutney/setup: Reduce sleep
Now that arti listens immediately, a very short sleep ought to do.
2022-02-18 14:08:37 +00:00
Ian Jackson e0630fda7e arti cli: Add some anyhow context() calls 2022-02-18 14:05:40 +00:00
Ian Jackson 3f8d566a7a arti cli: socks proxy: Start listening immedately
This makes arti less awkward to use.
2022-02-18 14:04:42 +00:00
Ian Jackson 460b94ef14 arti cli: Do config watch setup before entering future select
IMO this clarifies things a bit, and makes things more deterministic.
2022-02-18 13:55:12 +00:00
Nick Mathewson e3e3f9934b Move the main body of our circuit-launching task into a new function
This reduces our nesting, and will help us handle panics.
2022-02-18 08:33:50 -05:00
Dimitris Apostolou 5d61c3cf88
Fix typos 2022-02-18 15:29:02 +02:00
eta 74aa16e87a Merge branch 'script-filenames' into 'main'
Remove extension from scripts

See merge request tpo/core/arti!328
2022-02-18 12:50:16 +00:00
Ian Jackson f5a489e28c Placate rustfmt
I think all of this diff is a strict disimprovement, but whatever.
2022-02-18 12:48:17 +00:00
Ian Jackson 4a007beba7 Placate clippy 2022-02-18 12:48:00 +00:00
Ian Jackson 0eba24cb43 Add missing docs for report_and_exit 2022-02-18 12:46:58 +00:00
Ian Jackson 1e811a71d3 Add a missing anyhow context() call 2022-02-18 12:10:31 +00:00
Ian Jackson 8c4726b55e Provide error reporter and use it in the arti binary 2022-02-18 12:10:31 +00:00
Ian Jackson ccb4604237 Merge branch 'no-http-status-err' into 'main'
dirclient: Remove HttpStatus error variant

Closes #349

See merge request tpo/core/arti!329
2022-02-18 12:04:54 +00:00
Ian Jackson d3ab2bb636 maint/add_warning: Remove duplicate argv0 from usage message 2022-02-18 11:46:06 +00:00
Ian Jackson 894944ba5f maint/gen_md_links: Add missing +x bit
This is a program, with a main function, etc.
2022-02-18 11:46:06 +00:00
Ian Jackson 1c301230e4 rename *.py scripts to bare name
Update all references.  There are three remaining hits for
  git-grep '\.py\b'
all of which are scripts in "little-t-tor", not here in arti.
2022-02-18 11:46:06 +00:00
Ian Jackson 9aefbf4227 rename *.sh scripts to bare name
As per #309

Update all references.  There is one remaining hit for
  git-grep '\.sh\b'
namely "build.sh" in maint/reproducible_build, which I think is
the build script for osxcross - ie, an external project.
2022-02-18 11:46:06 +00:00
Nick Mathewson 1572fc520e spelling fix 2022-02-17 15:59:56 -05:00
Nick Mathewson 023ff75a64 Add #[display] annotations for remaining ErrorKinds. 2022-02-17 15:18:19 -05:00
Nick Mathewson 64a0d4dce5 dirclient: Remove HttpStatus error variant
Getting a non-200 status is no longer a failure condition; it's just
a different kind of answer.

Closes #349.
2022-02-17 15:12:00 -05:00