Commit Graph

3403 Commits

Author SHA1 Message Date
Nick Mathewson 95200383b5 fs-mistrust: make Mistrust have a corresponding Builder type.
This is an approximately minimal revision to get Builder in place;
subsequent commits will clean up the API.
2022-05-24 10:54:02 -04:00
Nick Mathewson baa58daace fs-mistrust: rename fields
This renaming will make things slightly simpler for declaring a
builder.
2022-05-24 10:54:02 -04:00
Ian Jackson 85faa1c0f6 Merge branch 'upgrades-20220523' into 'main'
Update to newer sanitize-filename and tinystr.

See merge request tpo/core/arti!523
2022-05-24 13:22:01 +00:00
Ian Jackson dae2ccd692 Merge branch 'clippy_pass' into 'main'
Make clippy +nightly pass again

See merge request tpo/core/arti!522
2022-05-24 13:21:24 +00:00
Nick Mathewson c27b3cb701 Update to newer sanitize-filename and tinystr. 2022-05-23 16:02:50 -04:00
Nick Mathewson 90b8a927a3 Merge branch 'check-pid-squashed' 2022-05-23 13:08:03 -04:00
Jim Newsome 48e1c75584 chutney/teardown: validate that pid is set 2022-05-23 13:07:59 -04:00
Nick Mathewson 546ae3000e Resolve the new `derive_partial_eq_without_eq` lint.
It's a little overzealous sometimes, but it's mostly to the good.
2022-05-23 12:55:37 -04:00
Nick Mathewson 2f1803f4c6 Suppress clippy warnings in tor-basic-utils.
These are warnings that we've decided it's okay to suppress elsewhere.
2022-05-23 12:55:37 -04:00
Nick Mathewson aaa8bfcb53 Merge branch 'remove_dbgs' into 'main'
Remove dbg!()s in tor-config, and fix nightly CI

See merge request tpo/core/arti!516
2022-05-23 16:18:46 +00:00
eta 0861827d90 Merge branch 'update-min-async-compression' into 'main'
async-compression minimum version 0.3.5 -> 0.3.14

Closes #473

See merge request tpo/core/arti!521
2022-05-23 15:43:28 +00:00
eta 55ce1fea79 Merge branch 'streamprefs-test' into 'main'
add unit tests for arti_client::StreamPrefs

See merge request tpo/core/arti!520
2022-05-23 15:41:26 +00:00
Jim Newsome e33cae6cb6
async-compression minimum version 0.3.5 -> 0.3.14
0.3.14 is the first released version to include
e724673876,
which fixes https://gitlab.torproject.org/tpo/core/arti/-/issues/473
2022-05-23 10:01:18 -05:00
michael mccune 0d8f520faf add unit tests for arti_client::StreamPrefs
this change adds unit tests for the public methods of StreamPrefs. although
these are mostly "setter" style functions, the tests confirm the basic
expectations and operation.
2022-05-23 10:55:17 -04:00
Ian Jackson 60551711b8 Merge branch 'channel' into 'main'
channel: Provide and use Sink::prepare_send_from

See merge request tpo/core/arti!514
2022-05-23 11:39:39 +00:00
Ian Jackson 2fc6c8a194 prepare_send_from: clippy: Replace some or_else with or 2022-05-23 11:28:05 +01:00
Ian Jackson 86d5768c05 prepare_send_from: clippy: Have dprintln explicitly return () 2022-05-23 11:28:05 +01:00
Ian Jackson d3f261d5ef prepare_send_from: clippy: Avoid a lint
I think this is worse code, but it's not *significantly* worse.
2022-05-23 11:28:05 +01:00
Ian Jackson 24dde5ddf1 prepare_send_from: clippy: Add missing docs
I intend to reintroduce this in its own MR.
2022-05-23 11:28:05 +01:00
Ian Jackson 739e5b52b1 prepare_send_from: clippy: Replace two unwraps 2022-05-23 11:28:05 +01:00
Ian Jackson 94038a9227 prepare_send_from: Break out get_output! macro
So we can change unwrap to expect, which makes this too long to repeat.
2022-05-23 11:28:05 +01:00
Ian Jackson 9fd0050acf prepare_send_from: docs and comments improvements
Apropos review.
2022-05-23 11:28:05 +01:00
Ian Jackson 426ff28b73 prepare_send_from: Add tests
When I added these tests, they didn't find any bugs in my own
implementation, but I did find a bug in futures::future::unfold.
See the in-code comment.
2022-05-23 11:28:05 +01:00
Ian Jackson 793782acc8 channel: Provide and use Sink::prepare_send_from
This is a general-purpose implementation of the ad-hoc approach
currently taken in (eg) crates/tor-proto/src/channel/reactor.rs,
with an API intended to defned against the more obvious mistakes.

This allows us to separate the two concerns: the channel reactor can
focus on handling channel cells and control messages and is over 2.5x
shorter.

The complexity of the manual sink implementation, and the machinery
needed to avoid having to suspend while holding an item, are dealt
with separately.  That separate implemenation now has proper
documentation.  (Tests are in the nest commit to avoid this one being
even more unwieldy.)

We use `extend` to define this as an extension trait.  A competitor is
`ext` but in my personal projects I have found `extend` slightly
better.
2022-05-23 11:28:05 +01:00
eta b137d64e18 Update Gitlab CI config for Gitlab 14.10
see https://gitlab.com/gitlab-org/gitlab/-/issues/344533
2022-05-23 10:14:09 +00:00
eta a6c7818d8e Merge branch 'update-async-compression' into 'main'
async-compression v0.3.12 -> v0.3.14

Closes #473

See merge request tpo/core/arti!517
2022-05-23 09:59:44 +00:00
Jim Newsome d54faaf500
async-compression v0.3.12 -> v0.3.14
This is to pick up
https://github.com/Nemo157/async-compression/pull/148#issuecomment-1128862482

Fixes https://gitlab.torproject.org/tpo/core/arti/-/issues/473
2022-05-20 16:33:19 -05:00
Nick Mathewson 994426d18c Add a couple of "pub use" to make nightly rustdoc pass. 2022-05-20 12:12:23 -04:00
Nick Mathewson 9d26a91886 Remove dbg!()s in tor-config
This should satisfy our CI and turn it green again.
2022-05-20 10:34:32 -04:00
eta b4e9e42278 Merge branch 'cert_dl_recovery_v3' into 'main'
DirMgr: Revise error handling to better tolerate reset-able failures

Closes #412 and #439

See merge request tpo/core/arti!511
2022-05-19 12:32:31 +00:00
Nick Mathewson 5b5b4bbbea Simplify advance and reset functions with mem::replace. 2022-05-19 08:09:05 -04:00
Nick Mathewson eab0046d0e Explain why we call update_status unconditionally. 2022-05-19 08:04:57 -04:00
Nick Mathewson 6aebb18e64 Remove BootstrapAction::Impossible
It does nothing that Fatal does not.  Suggested by @eta in review.
2022-05-19 08:00:41 -04:00
Nick Mathewson c70916c0d9 Fix compilation with Rust 1.56. 2022-05-17 14:58:36 -04:00
Nick Mathewson 5de1b93195 DirMgr: Remove blocking_error return path. 2022-05-17 12:25:32 -04:00
Nick Mathewson 53ed5f40cf DirMgr: Unify error return paths
We no longer have separate return paths for recoverable and fatal
errors; instead, they are merged, and distinguished based on
recovery actions.

Since it is now possible for download() to give an error that should
_not_ destroy the previous state, it takes `&mut Box<dyn DirState>`.
This change unfortunately means that we can no longer call `state =
state.advance()`, but instead have to do some mem::swap junk with
poisoned values.  Any better solution would be a good thing.

Additionally, the reset() and advance() methods can no longer fail.

There is still a separate return path for reset-triggering errors;
I'm about to fix that.
2022-05-17 12:25:32 -04:00
Nick Mathewson 6450a4113f Merge branch 'backtrace' into 'main'
Do backtrace string matching test only on some platforms.

See merge request tpo/core/arti!512
2022-05-17 15:10:09 +00:00
Nick Mathewson d7a3fd2c17 DirMgr: Remove special handling of "changed" boolean 2022-05-17 10:16:15 -04:00
Ian Jackson 273879cb14 Placate rustfmt
I found the previous layout *much* better.  Ah well.
2022-05-17 15:04:10 +01:00
Ian Jackson 298b2421f0 Do backtrace string matching test only on some platforms.
"Fixes" #455 by suppressing the test.

This is !509 redux.
2022-05-17 15:03:46 +01:00
Nick Mathewson 6bacf3b303 DirMgr: Start refactoring error handling.
This commit adds a couple of new error types that we will soon want
to distinguish, and a new way of classifying errors.  These are not
yet all used.
2022-05-17 09:52:44 -04:00
Nick Mathewson f83146bef4 Fix a portability issue with Rust 1.56 2022-05-16 15:02:28 -04:00
Nick Mathewson e37e37a31c Give an error if the cache violates If-Modified-Since.
This should be sufficient to detect several kinds of nefariousness
that we'd previously overlooked.
2022-05-16 12:49:49 -04:00
Nick Mathewson 37f6730077 Add missing extend_tolerance to add_consensus_text.
This should have gone in when we fixed #412
2022-05-16 12:49:49 -04:00
Nick Mathewson ffc864015a DirMgr: Blame the correct cache for consensus validation failure 2022-05-16 12:49:49 -04:00
Nick Mathewson c55738e745 Move consensus signature verification to add-document code.
Previously, we did this in `advance()`, but that wasn't so great: it
meant that we could fail in the advance() code, whereas the calls to
`advance()` treated errors as fatal.

This treats failed verification as a blocking error that requires a
reset.

Fixes one aspect of #439.
2022-05-16 12:49:49 -04:00
Nick Mathewson d1af40e638 On a blocking error, blame the appropriate directory cache
Fortunately, the only error type that we need to handle blocking
errors with actually has a DirSource in it already.
2022-05-16 12:49:49 -04:00
Nick Mathewson 40539cb25e DirMgr: Add a way for a state to report a blocking error.
(A blocking error is one that means that the current bootstrap
attempt has failed, and must be restarted.)
2022-05-16 12:42:25 -04:00
Nick Mathewson b94f56d6f5 Implement nonfatal errors in add_from_* 2022-05-16 12:42:25 -04:00
Nick Mathewson d8bd862f2b DirMgr: Let add_from_* distinguish non-fatal errors
Previously all errors were treated as non-fatal.

The add_from_* implementations don't yet behave properly;
I'll fix them in subsequent commits.
2022-05-16 12:42:25 -04:00