aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'proto_handshake_err' into 'main'Nick Mathewson2022-02-241-16/+23
|\ | | | | | | | | | | | | tor-proto: Split up a couple of handshake-based errors Closes #359 and #358 See merge request tpo/core/arti!344
| * tor-proto: refactor handshake protocol errors to a different typeNick Mathewson2022-02-231-3/+11
| | | | | | | | | | | | | | | | This helps the user distinguish between protocol violations that happen when connecting to the tor network from those that happen while connected. Closes #358.
| * tor-proto: Rename BadHandshake to BadCircHandshakeNick Mathewson2022-02-231-4/+4
| | | | | | | | (We'll have a BadChanHandshake soon.)
| * tor-proto: Split IoErr based on when it occursNick Mathewson2022-02-231-11/+10
| | | | | | | | | | | | | | We want to distinguish handshake failures from errors later on in the channel's lifetime. Closes #359.
* | Give specific error kinds to different END reasonsNick Mathewson2022-02-231-3/+1
|/ | | | Closes #360.
* Eliminate RequestedResourceAbsent kind.Nick Mathewson2022-02-221-6/+2
| | | | | | | | 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.
* Fold NamespaceFull into BadApiUsage.Nick Mathewson2022-02-221-1/+1
|
* Rename RemoteNameError to RemoteHostNotFoundNick Mathewson2022-02-221-2/+2
| | | | | 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.
* Replace RemoteRefused with CircuitRefused.Nick Mathewson2022-02-221-1/+1
| | | | Also document that it's a lower-level error kind.
* Rename RemoteIdMismatch to RelayIdMismatch.Nick Mathewson2022-02-221-1/+1
|
* Fold AlreadyClosed into BadApiUsageNick Mathewson2022-02-221-1/+1
|
* tor_proto::Error: Fix an incomplete sentence.Nick Mathewson2022-02-161-1/+2
|
* Update tor-proto errors to latest API.Nick Mathewson2022-02-151-21/+17
|
* Make tor-proto::Error implement HasKind.Nick Mathewson2022-02-151-16/+42
| | | | | | 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.
* tor-proto: use InternalError for internal errors.Nick Mathewson2022-02-151-2/+3
|
* Use atomic set-and-check to update OptTimestamps if none.Nick Mathewson2022-02-091-0/+36
| | | | | | | 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.
* Remove the use of Mutex in channel unused_since timestampYuan Lyu2022-02-081-26/+43
|
* fix nightly clippy errorsTrinity Pointard2021-12-091-1/+1
|
* add semicolons if nothing returnedDaniel Eades2021-11-252-2/+2
|
* Get rid of unbounded stream sender, and RawCellStreameta2021-11-121-1/+6
| | | | | | | | | | | | | | | | | | | | | Previously, the reactor would use an `UnboundedSender` to send things to the `RawCellStream`, in order that the reactor wouldn't block if you failed to read from the latter. This is bad, though, since it means people can just run us out of memory by sending lots of things. To fix this, we make the new `StreamReader` type (which does the reading parts from `RawCellStream`) keep track of the stream's receive window and issue SENDMEs once *it* has consumed enough data to require it, thus meaning that we shouldn't get sent enough data to fill the channel between reactor and `StreamReader` (and, if we do, that's someone trying to flood us, and we abort the circuit). As hinted to above, the `RawCellStream` was removed and its reading functionalities replaced by `StreamReader`; its writing functionalities are handled by `StreamTarget` anyway, so we just give out one of those for the write end. This now means we don't need any mutexes! note: this commit introduces a known issue, arti#230
* Use coarsetime to build an incoming traffic timestamp.Nick Mathewson2021-11-021-0/+99
| | | | | | | | | | | | | | | | We need this for the circuit timeout estimator (#57). It needs to know "how recently have we got some incoming traffic", so that it can tell whether a circuit has truly timed out, or whether the entire network is down. I'm implementing this with coarsetime, since we need to update these in response to every single incoming cell, and we need the timestamp operation to be _fast_. (This reinstates an earlier commit, f30b2280, which I reverted because we didn't need it at the time.) Closes #179.
* Use subtle and some refactoring to remove branches in ntorNick Mathewson2021-10-011-1/+8
| | | | Closes #163
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-272-0/+231
This will cause some pain for now, but now is really the best time to do this kind of thing.