Commit Graph

1940 Commits

Author SHA1 Message Date
Ian Jackson 23c352b96b clippy: Consolidate many lints in maint/add_warning
Found these by disabling the nightly dbg macro special case.  Now, we
have a mechanism for globally adding suppressions to tests, we can use
that instead.
2022-06-24 14:23:38 +01:00
Ian Jackson d965dc3f70 clippy: Add standard test lint block to several examples 2022-06-24 14:23:38 +01:00
Ian Jackson bebf013bef maint/add_warning: Add two lints via add_warning as a test case 2022-06-24 14:23:38 +01:00
Ian Jackson 72515abf91 maint/add_warning: Add ability maintain test lint blocks 2022-06-24 14:23:38 +01:00
Ian Jackson 589c6e52bb Run maint/add_warning crates/*/src/{lib,main}.rs
Update all lint blocks
2022-06-23 19:15:42 +01:00
Nick Mathewson 210f3f1587 Merge branch 'error_cleanup' into 'main'
Error cleanup, part 1

See merge request tpo/core/arti!601
2022-06-22 19:43:50 +00:00
Nick Mathewson 813a648ce2 fs-mistrust: convert Io error variant to a struct. 2022-06-22 15:21:34 -04:00
Nick Mathewson 0369995364 tor-cell: convert BytesErr to a struct variant 2022-06-22 15:21:12 -04:00
Nick Mathewson c3da82fc2d tor-cell: error usefulness and style fixes 2022-06-22 10:02:42 -04:00
Nick Mathewson e3e922d03f Improve error messages in tor-checkable. 2022-06-22 09:48:42 -04:00
Nick Mathewson 5577163387 tor-socksproto: Style and info fixes in errors.
(The use of Cow<> in the error message isn't strictly necessary
here, but it's a pattern I want to encourage.)
2022-06-22 09:16:44 -04:00
Nick Mathewson 3120f1092a Style fixes to tor-bytes errors.
Also note an issue with the design of tor-bytes::Error that should
probably go in a separate MR.
2022-06-22 09:00:59 -04:00
Nick Mathewson 7163b7dcc0 Style fixes to tor-protover errors. 2022-06-22 08:50:44 -04:00
Nick Mathewson f6d6ac7fe9 tor-llcrypto: style fixes on BlindingError 2022-06-22 08:47:18 -04:00
Nick Mathewson 9ba7750dfe Style fixes to tor-units errors. 2022-06-22 08:42:13 -04:00
Nick Mathewson bf2336e547 Style fixes to tor-events errors. 2022-06-22 08:39:44 -04:00
Nick Mathewson c39631af27 tor-config: style fixes on CfgPathError. 2022-06-22 08:36:13 -04:00
Nick Mathewson 37cbd38abc tor-config: Don't format source error as part of error message
This is one I missed earlier.
2022-06-22 08:23:33 -04:00
Nick Mathewson 48653df68f Style fixes to retry-error error messages. 2022-06-22 08:11:44 -04:00
Nick Mathewson 9102948045 Style fixes to safelog errors. 2022-06-22 08:07:37 -04:00
Nick Mathewson 326ab1a7ae Editorial improvements on fs-mistrust errors
These changes make sure that the errors conform to our preferred
style, and include a description of what exactly we were doing when
something went wrong.
2022-06-22 08:03:15 -04:00
eta 4e3537746f Merge branch 'display_source_cleanup' into 'main'
Do not include error source() in display() format.

See merge request tpo/core/arti!598
2022-06-21 19:34:27 +00:00
Ian Jackson 9b4ba4893e Merge branch 'stalled_directory' into 'main'
Detect and report stalled directory downloads

Closes #468

See merge request tpo/core/arti!587
2022-06-21 19:13:40 +00:00
Ian Jackson da2e53bf76 tor-chanmgr: Change to use unwrap_void
As per discussion in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813573
2022-06-21 19:19:28 +01:00
Ian Jackson a2614729a4 channel padding: Rename ChannelsParams from ChannelsConfig (rustfmt)
Consequential ordering changes.
2022-06-21 19:19:28 +01:00
Ian Jackson 7d676cde02 channel padding: Rename ChannelsParams from ChannelsConfig
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276

Change names and comments and docs everywhere.
2022-06-21 19:19:28 +01:00
Ian Jackson ff228e5d9c channel padding: chanmgr: Clarify a comment
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813574
2022-06-21 19:19:28 +01:00
Ian Jackson 65e6683b0b tor-proto: Have Channel::reconfigure throw ChannelClosed
Addresses
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813567
2022-06-21 19:19:28 +01:00
Ian Jackson 13ca24ba3a tor-proto: err: Provide ChannelClosed as a separate unit error 2022-06-21 19:19:28 +01:00
Ian Jackson 19c52ff8e4 channel padding: Use IntegerMilliseconds in netdir 2022-06-21 19:19:28 +01:00
Ian Jackson db71018021 tor-netdir: Make CHANNEL_PADDING_TIMEOUT_UPPER_BOUND pub
We need this because it is a type parameter for the types of nf_ito_*.
2022-06-21 19:19:28 +01:00
Ian Jackson 9779e5a2e2 channel padding: Use IntegerMilliseconds in padding::Parameters 2022-06-21 19:19:28 +01:00
Ian Jackson b1b840c7c6 tor-units: IntegerTimeUnit: Provide try_map
This lets a caller map the inner value, eg to convert the type.
I don't provide `map` as well as `try_map` now, since I don't need it;
we could add it later if it is desirable (although try_map can always
be used instead).

I was hoping to provide a `TryFrom` instead, but that necesasrily
overlaps with the std conversion impl from IntegerMilliseconds<T> to
IntegerMilliseconds<U> where T == U.
2022-06-21 19:19:22 +01:00
Ian Jackson 0ea34e3280 tor-units: IntegerTimeUnit: Relax condition on T
It is semantically quite meaningful for these to contain something
that isn't `TryInto<u64>`.  (Of course the `Duration` conversion won't
work without that.)

Indeed, this condition was only applied to two out of the three types.

Prompted by being near this code, but not actually necessary for
anything I'm doing here.
2022-06-21 19:19:22 +01:00
Ian Jackson ec756c79e7 tor-units: IntegerTimeUnit: Provide as_time_unit deconstructor
We're going to need this to use this in the padding timer parameters.
2022-06-21 19:19:22 +01:00
Ian Jackson db4e5aba97 channel padding parameters update: Drop a redundant clone 2022-06-21 19:19:22 +01:00
Ian Jackson a5aaa56c3c channel padding: Change timeout to match C Tor
Pending an official value from the spec.
2022-06-21 19:19:22 +01:00
Ian Jackson 2d97ab3677 Fix docs for `CtrlMsg::ConfigUpdate`
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813565
2022-06-21 19:19:22 +01:00
eta 54c7070b30 Fix typos 2022-06-21 19:19:22 +01:00
Ian Jackson d2b783641d channel padding: Test timeout updates 2022-06-21 19:19:22 +01:00
Ian Jackson e0040701d0 tor-chanmgr tests: Add config_update tracking to FakeChannel 2022-06-21 19:19:22 +01:00
Ian Jackson 6e07401e6b channel padding: Honour NetDir for timeouts
But padding is still not enabled by default.
2022-06-21 19:19:22 +01:00
Ian Jackson e53555f418 channel padding: Add the parameters from the spec to NetDir 2022-06-21 19:19:22 +01:00
Ian Jackson 7f3f426738 channel padding: Plumb settings from chanmgr 2022-06-21 19:19:22 +01:00
Ian Jackson b5218a0c0e channel padding: Introduce ChannelsConfig and reconfigure facility
Nothing geenrates config updates yet.
2022-06-21 19:19:22 +01:00
Ian Jackson 33ef338fe2 chanmgr: inner (map): Reorganise to prepare for having more state
The main copy of the (global) configuration for the client's channels
is going to have to live here, inside this mutex.  So this really
needs to become a struct with names fields.
2022-06-21 19:19:22 +01:00
Ian Jackson 09b40d7d81 channel padding timer: Support reconfiguration
Nothing calls this yet.
2022-06-21 19:19:22 +01:00
Ian Jackson e5f3215b95 channel padding timer: Allow creation without providing parameters yet
It turns out that we are going to want this.
2022-06-21 19:19:22 +01:00
Ian Jackson f9414a29b2 channel padding: Test creation in disabled state
We're about to split the main new() function off so write a separate
test for new_disabled().
2022-06-21 19:19:22 +01:00
Ian Jackson 7135b7c4c7 channel padding: Make Parameters a pub struct with builder
chanmgr is going to want to make one of these from a NetDir.
2022-06-21 19:19:22 +01:00