summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * Use atomic set-and-check to update OptTimestamps if none.Nick Mathewson2022-02-092-4/+38
| | | | | | | | | | | | | | 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.
* | Rename bootstrap_existing to bootstrap.Nick Mathewson2022-02-112-12/+10
| | | | | | | | (Looks like this one got missed.)
* | Merge branch 'eta/unbootstrapped-clients' into 'main'Nick Mathewson2022-02-1111-93/+384
|\ \ | | | | | | | | | | | | | | | | | | Allow creating unbootstrapped `TorClient`s (and `DirMgr`s) Closes #293 See merge request tpo/core/arti!298
| * | Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)eta2022-02-1111-93/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes how the `TorClient` type works, enabling it to be constructed synchronously without initiating the bootstrapping process. Daemon tasks are still started on construction (although some of them won't do anything if the client isn't bootstrapped). The old bootstrap() methods are now reimplemented in terms of the new create_unbootstrapped() and bootstrap_existing() methods. This required refactoring how the `DirMgr` works to enable the same sort of thing there. closes #293
* | | Merge branch 'connect_examples' into 'main'eta2022-02-111-5/+64
|\ \ \ | | | | | | | | | | | | | | | | Write some examples for TorClient::connect() See merge request tpo/core/arti!303
| * | | Write some examples for TorClient::connect()Nick Mathewson2022-02-111-5/+64
| | | | | | | | | | | | | | | | | | | | | | | | These should explain better what you can pass as an address, and what you should do if you _really need_ to provide a SocketAddr or something.
* | | | socksproto: fix one more error type.Nick Mathewson2022-02-111-1/+1
| | | |
* | | | socksproto: Simplify Truncated handlingNick Mathewson2022-02-113-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the Error type to remove the yucky internal hidden Truncated variant. Instead, there's now an embedded tor_bytes::Error value. If that tor_bytes::Error is Truncated, we bubble it up when we convert our handshake result to the nested error struct. Thus there is still (sadly) a variant of tor_socksproto::Error that shouldn't be exposed to user code. But refactoring every inner method under handshake.rs seemed like a bad idea: once we're using Result<Result<..>>, the ? operator no longer helps us much.
* | | | Move the Truncated error into tor-errors.Nick Mathewson2022-02-115-19/+30
| | | |
* | | | Try to resolve the "Truncated" error in tor-socksprotoNick Mathewson2022-02-114-50/+66
| | | | | | | | | | | | | | | | | | | | I'm not in love with this solution; the others just seem a bit ugly too.
* | | | tor-socksproto: Implement HasKindNick Mathewson2022-02-114-10/+92
|/ / / | | | | | | | | | | | | (This error isn't yet wrapped in TorError, but it will be eventually when we implement socks proxy and PT support.)
* | | Merge branch 'typos' into 'main'Nick Mathewson2022-02-101-1/+1
|\ \ \ | | | | | | | | | | | | | | | | Fix typos See merge request tpo/core/arti!301
| * | | Fix typosDimitris Apostolou2022-02-101-1/+1
| | | |
* | | | tor-bytes: Use InternalError.Nick Mathewson2022-02-093-3/+18
|/ / / | | | | | | | | | | | | | | | This crate's Error type is too low-level to have an ErrorKind, but it does make sense to use InternalError for the internal errors here.
* | / tor-config: Add HasKind support.Nick Mathewson2022-02-094-0/+79
| |/ |/| | | | | This required a few new ErrorKinds.
* | Add TODOs on uncertain points about time_since_last_trafficNick Mathewson2022-02-092-0/+2
| | | | | | | | | | | | This edge-case was there even before the migration of 595fe1ab881b94106649, but now it's more explicit and ought to be revisited.
* | Remove the use of Mutex in channel unused_since timestampYuan Lyu2022-02-086-65/+83
|/
* Update launch of chan expiration task to new APINick Mathewson2022-02-081-4/+6
| | | | This fixes a compilation error.
* ErrorDetail Simplify visibility macros a bit.Nick Mathewson2022-02-082-19/+53
| | | | | | | | Instead of declaring a macro that takes vis as an argument, we now conditionally declare a macro that applies an appropriate visibility. There's a long comment explaining the rationale here, along with a couple of other solutions that don't work.
* Rename TorResult to Result.Nick Mathewson2022-02-083-27/+28
| | | | | | | This is closer to common usage. (Not that we all agree with common usage, but it's closer to what people expect.)
* arti_client: Rename Error to ErrorDetail.Nick Mathewson2022-02-084-48/+43
| | | | | | | This is closer to what we described in Errors.md. Also, remove the (sometimes private) Result alias: it was only used in one or two places, and never exposed in public.
* TorError: Make detail() an accessor function.Nick Mathewson2022-02-081-4/+25
| | | | | | This change lets us make TorError's members unconditionally hidden, and makes our API a little more consistent (since basically nothing else is a public field).
* Merge branch 'error-improvements' into 'main'eta2022-02-0815-225/+469
|\ | | | | | | | | Hopefully uncontroversial improvements to new Error code See merge request tpo/core/arti!291
| * Tests for TargetPorts::display()Nick Mathewson2022-02-041-1/+12
| |
| * tests for tor-error::internalNick Mathewson2022-02-041-1/+47
| | | | | | | | | | | | These tests turned up a need for using the #[track_caller] annotation in order to get accurate locations, which is fortunately stable since Rust 1.46.0.
| * Docs and clarification for a bunch of Error stuffNick Mathewson2022-02-043-73/+134
| |
| * Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-049-94/+164
| | | | | | | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
| * Make the Error detail type non-exported from arti-clientNick Mathewson2022-02-045-44/+51
| | | | | | | | | | | | | | | | | | | | | | At least by default, we should have Error be private, and not expose it as part of our APIs. To keep functionality in `arti`, I had to add an `ExitTimeout` error kind. For interface consistency, I also re-exported ErrorKind and HasError from `arti_client`.
| * Test that TorError implements the right traits.Nick Mathewson2022-02-041-3/+21
| | | | | | | | | | I had planned to use assert_impl, but that can't check for the 'static lifetime.
| * Make TorError implement Clone.Nick Mathewson2022-02-043-10/+41
| | | | | | | | | | This patch makes only minimal changes in lower-level error types: we have more refactoring to do.
* | Clean up ChannelState ready_to_expireYuan Lyu2022-02-061-10/+9
| |
* | Expire channels that have been unused for too longYuan Lyu2022-02-049-30/+304
|/
* Fix a doc link.Nick Mathewson2022-02-041-1/+2
|
* Merge branch 'error-poc' into 'main'Nick Mathewson2022-02-0428-61/+743
|\ | | | | | | | | New error handling proof of concept See merge request tpo/core/arti!262
| * Require backtrace 0.3.8.Nick Mathewson2022-02-041-1/+1
| | | | | | | | | | | | This is the first version that builds correctly on our CI. It's from back in 2018, so requiring it shouldn't cause any major problems.
| * channel errors: Include what we were doingIan Jackson2022-02-042-11/+16
| |
| * errors: Add some TODOs as per discussion commentsIan Jackson2022-02-042-0/+8
| |
| * errors: ErrorKind::TODO: Fix typo in messageIan Jackson2022-02-041-1/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/262#note_2772816
| * errors: Change docs for ErrorKind to refer to ArtiIan Jackson2022-02-041-2/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/262#note_2772810
| * errors: Drop "Error" and "Failed" from various enum variantsIan Jackson2022-02-047-9/+9
| |
| * Box the Error in a TorErrorIan Jackson2022-02-041-2/+10
| | | | | | | | | | | | This will get quite large and boxing it here is very convenient. This also avoids us exposing a large error type to our callers.
| * errors: Handle exit circuit creation failure the new wayIan Jackson2022-02-042-2/+22
| |
| * errors: Handle circmgr setup errors differentlyIan Jackson2022-02-042-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The motivation for doing this now is to remove the `#[from]` so we would spot where operationsl circuit setup failures were handled. (But it turns out that they are turned into internal errors!) Perhaps this will want to become a different error type from circmgr in due course, but for now we simply use a bespoke variant of TorError. It will want its own Kind. The TODO in the HasKind impl marks this (amongst much else here).
| * tor-circmgr: Introduce TargetPorts with a pretty Display implIan Jackson2022-02-042-2/+35
| |
| * tor-circmgr::Error: impl HasKindIan Jackson2022-02-041-0/+12
| |
| * tor-circmgr: Handle channel creation errors in the new styleIan Jackson2022-02-042-4/+19
| |
| * tor-chanmgr::Error: impl HasKindIan Jackson2022-02-042-0/+21
| |
| * tor-chanmgr: Handle IO errora in the new styleIan Jackson2022-02-042-14/+26
| | | | | | | | | | Two ? in the tests become expects, which will do. That avoids having to construct a proper error with context here.
| * errors: Introduce error_detail featureIan Jackson2022-02-044-3/+39
| | | | | | | | | | Right now we must always expose the `Error` type since we haven't converted everything.
| * errors: Refer to err::Error in some bits of arti_clientIan Jackson2022-02-044-9/+11
| | | | | | | | We are going to make the top-level Error type conditionally hidden.