Commit Graph

143 Commits

Author SHA1 Message Date
Nick Mathewson 6755648f6b Merge branch 'upgrade-dependencies' into 'main'
Upgrade a few dependencies to newer versions

See merge request tpo/core/arti!357
2022-02-25 16:30:00 +00:00
Nick Mathewson 4becaa01b9 Bump minimum tokio to 1.7, since tokio-util now needs that. 2022-02-25 11:09:24 -05:00
Nick Mathewson 55416937cc Upgrade dependency to new version of tokio-util. 2022-02-25 08:48:00 -05:00
Ian Jackson 3903900461 tor-proto datastream: Fix typo in Debug impl
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/353#note_2781632
2022-02-25 12:23:49 +00:00
eta 3e37d7e105 Merge branch 'debug-datastream' into 'main'
tor-proto datastream: Do not dump packet data in DataWriterImpl

See merge request tpo/core/arti!353
2022-02-24 21:30:52 +00:00
Ian Jackson 78ab634ed9 Fix rustfmt 2022-02-24 19:45:58 +00:00
Nick Mathewson 7f3ea03e58 Merge branch 'proto_handshake_err' into 'main'
tor-proto: Split up a couple of handshake-based errors

Closes #359 and #358

See merge request tpo/core/arti!344
2022-02-24 19:44:34 +00:00
Ian Jackson f3520478b1 tor-proto datastream: Do not dump packet data in DataWriterImpl 2022-02-24 19:39:18 +00:00
Ian Jackson 097c852e58 tor-proto datastream: import std::fmt::Debug trait name 2022-02-24 19:39:18 +00:00
eta 3e4358c5d3 Merge branch 'remote_stream_err' into 'main'
Give specific error kinds to different END reasons

Closes #360

See merge request tpo/core/arti!343
2022-02-24 19:31:41 +00:00
eta b5cd85b401 Merge branch 'debug-datastream' into 'main'
impl Debug for DataStream (and its components)

See merge request tpo/core/arti!351
2022-02-24 18:36:19 +00:00
Nick Mathewson d8120e1649 proto: Refactor conversion from CodecError to Error
Remove default conversion; instead use a specific conversion in each
of the two modules that need to do it.
2022-02-24 13:23:42 -05:00
Ian Jackson b56115a04f impl Debug for DataStream (and its components)
My proximate motivation is that tls-api wants its inner streams to be
Debug.  But in general, I agree with the Rust API Guidelines notion
that almost everything should be Debug.

I have gone for the "dump all the things" approach.  A more nuanced
approach would be possible too.
2022-02-24 17:49:34 +00:00
Nick Mathewson 74a5ce8635 tor-proto: refactor handshake protocol errors to a different type
This helps the user distinguish between protocol violations that
happen when connecting to the tor network from those that happen
while connected.

Closes #358.
2022-02-23 10:39:08 -05:00
Nick Mathewson d42b932ed9 tor-proto: Rename BadHandshake to BadCircHandshake
(We'll have a BadChanHandshake soon.)
2022-02-23 10:39:08 -05:00
Nick Mathewson afa49eac8f tor-proto: Split IoErr based on when it occurs
We want to distinguish handshake failures from errors later on in
the channel's lifetime.

Closes #359.
2022-02-23 10:38:48 -05:00
Nick Mathewson 6c615898e4 Give specific error kinds to different END reasons
Closes #360.
2022-02-23 09:35:28 -05:00
Nick Mathewson 92141c6d72 Merge remote-tracking branch 'origin/mr/340' 2022-02-23 09:29:40 -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 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 5351aaa308 Fold AlreadyClosed into BadApiUsage 2022-02-22 15:25:24 -05: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
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 62a62b6dfd tor_proto::Error: Fix an incomplete sentence. 2022-02-16 11:09:59 -05:00
Nick Mathewson 6b611d6dea Update tor-proto errors to latest API. 2022-02-15 09:57:03 -05:00
Nick Mathewson 4af279b173 Make tor-proto::Error implement HasKind.
This took some refactoring, and gave an opportunity to notice
a few error variants that weren't being used, or didn't mean
what they said on the tin.
2022-02-15 09:41:47 -05:00
Nick Mathewson f23f375e42 tor-proto: use InternalError for internal errors. 2022-02-15 09:41:11 -05:00
Nick Mathewson da0e9e456c tor-cell: provide HasKind.
Additionally, refactor the IoError out of tor_cell::Error:
nothing in TorCell created this; it was only used by tor_proto.

This required refactoring in tor_proto to use a new error type. Here I
decided to use a new CodecError for now, though we may refactor that
away soon too.
2022-02-15 09:41:10 -05:00
eta 29daf5a74a Merge branch 'warn_not_deny' into 'main'
Change deny(clippy::all) to warn(clippy::all).

Closes #338

See merge request tpo/core/arti!306
2022-02-14 19:45:18 +00:00
Nick Mathewson 1cecc7e45a Change deny(clippy::all) to warn(clippy::all).
Closes #338.
2022-02-14 09:24:06 -05:00
Nick Mathewson dc9f1afeb3 Use atomic set-and-check to update OptTimestamps if none.
This fixes a tiny race condition in the previous code, where we
checked whether an OptTimestamp is None a bit before we set it.
Since std::atomic gives us compare_exchange, we might as well use
it.
2022-02-09 10:24:31 -05:00
Yuan Lyu 595fe1ab88 Remove the use of Mutex in channel unused_since timestamp 2022-02-08 18:28:45 -05:00
Yuan Lyu f6f732a478 Expire channels that have been unused for too long 2022-02-04 22:52:51 -05:00
eta e9087e1fed Merge branch 'eta/reactor-2.5' into 'main'
Fix severe reactor ordering problems

See merge request tpo/core/arti!282
2022-02-03 16:27:57 +00:00
Nick Mathewson 03755a5c7b Merge branch 'dirclient-testing' into 'main'
dir-client: bug fix and more tests

See merge request tpo/core/arti!271
2022-02-03 15:09:06 +00:00
eta 24d12163f2 Fix severe reactor ordering problems
A number of severe problems with the circuit reactor were fixed which
could cause reordering of cells (which causes relays to terminate the
circuit with a protocol violation, as they become unable to decrypt
them). These mostly revolve around improper usage of queues:

- The code assumed that a failure to place cells onto the channel would
  persist for the duration of a reactor cycle run. However, under high
  contention, this wouldn't always be the case.
  - This leads to some cells getting enqueued while others go straight
    through, before the enqueued cells.
  - To fix this, we block sending cells out of the channel while there
    are still some enqueued.
- The hop-specific queues queued after encryption, not before. This was
  very brittle, and led to frequent mis-ordering.
  - This was fixed by making them not do that.

This is arti!264 / 5bce9db562 without the
refactor part.
2022-02-03 15:04:28 +00:00
eta cc37c8f5b5 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!285
2022-02-03 13:12:38 +00:00
Ian Jackson 7be3bf6339 Temporarily disable some clippy lints on nightly 2022-02-02 21:57:30 +00:00
Ian Jackson b7fec1c8a4 Remove many needless borrows and slices
Found via clippy::needless_borrow.  In some cases I removed needless
`[..]` too.  See also:
  needless_borrow suggestion doesn't go far enough
  https://github.com/rust-lang/rust-clippy/issues/8389
2022-02-02 18:34:26 +00:00
Dimitris Apostolou 6526321851
Fix typos 2022-02-02 20:18:22 +02:00
Nick Mathewson c8dd73d55f Upgrade required version of futures crate to 0.3.14
Earlier versions have a bug in UnboundedReceiver that make our new
dirclient tests fail.
2022-02-01 09:54:47 -05:00
Nick Mathewson 01d9937308 Bump the patch version of every crate that changed since 0.0.3 2022-01-31 10:30:52 -05:00
Nick Mathewson 5187b05c19 Use script to update README.md files. 2022-01-28 08:36:34 -05:00
Nick Mathewson 30b3818a9e Make the native-tls crate optional.
This commit puts the native-tls crate behind a feature.  The feature
is off-by-default in the tor-rtcompat crate, but can be enabled
either from arti or arti-client.

There is an included script that I used to test that tor-rtcompat
could build and run its tests with all subsets of its features.

Closes #300
2022-01-26 14:06:58 -05:00
Nick Mathewson 884d614a61 Remove a now-incorrect comment in tor-proto. 2022-01-26 14:06:58 -05:00
Ian Jackson 9a77b23cdd clippy: Rename a `decode_chanmsg` from `handle_`
As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/249#note_2771025

It doens't really handle it.
2022-01-19 18:46:13 +00:00