aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/impls/async_std.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-rtcompat: manually create and connect() socketSteven Engler2026-06-081-4/+3
| | | | | | | | | This will allow us in the future to set custom sockopts on the socket before calling connect(). I tested an arti proxy with tokio and async-std manually. Arti doesn't yet support smol so I was not able to test it, but it's using the same code as async-std so I would expect it to work.
* tor-rtcompat+misc: add `NetStreamProvider::ConnectOptions`Steven Engler2026-06-081-4/+20
| | | | | | | | | This adds the trait type `ConnectOptions` to `NetStreamProvider` and adds this `ConnectOptions` as an argument to `NetStreamProvider::connect()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* tor-rtcompat+misc: add `NetStreamProvider::ListenOptions`Steven Engler2026-05-071-3/+19
| | | | | | | | | This adds the trait type `ListenOptions` to `NetStreamProvider` and adds this `ListenOptions` as an argument to `NetStreamProvider::listen()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* tor-rtcompat: unfold for async-std incoming streamsmoumenalaoui2026-02-191-47/+9
|
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-0/+3
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* tor-rtcompat: use a consistent `listen()` implementationSteven Engler2025-11-101-1/+2
| | | | | | This gives us a consistent `listen()` implementation across runtimes, and gives us flexibility to customize the bind/listen process for TCP sockets.
* Fix Windows compile warningsTobias Stoeckmann2025-08-051-0/+1
| | | | | Use unix-specific crates only if needed and suppress clippy warnings of unused variables if their usage is unix-specific.
* AF_UNIX terminology: Rename two error structsIan Jackson2025-03-241-2/+2
| | | | | | We change `NoUnixAddressSupport` to `NoAfUnixSocketSupport` because it doesn't make much sense to talk about support for the addresses separately from support for the sockets.
* tor-rtcompat: Rename spawn_thread to spawn_blockingIan Jackson2025-03-041-1/+1
| | | | Let's use Tokio terminology here.
* tor-rtcompat: Provide a new function for executor re-entryIan Jackson2025-03-041-0/+4
| | | | | | | | | | | | | | | Forbid re-entering the executor using ToplevelBlockOn::block_on. This was always forbidden in the case of MockExecutor, but that meant that tests using MockExecutor would malfunction if the code under test needed to re-enter the executor from sync code (since the code under test would have to use block_on, which wrong). See #1835. Provide a function which *can* do this, reenter_block_on. The MockExecutor needs to know the difference, and other runtimes may too. They are conceptually quite different operations. Introduce ToplevelRuntime as a convenience alias.
* tor-rtcompat: New plan for blocking interaction, Blocking traitIan Jackson2025-03-041-3/+3
| | | | | | | | | | | | | | | * Document the new plan for blocking interaction in the trait-level docs for the Blocking trait (used to be SpawnBlocking). Add cross-references (in some cases to not-yet-existing pieces). * Rename: spawn_blocking to spawn_thread. We're going to distinguish thread-creation (relatively expensive) from brief entry to sync code (relatively cheap, but more restricted). * Rename the SpawnBlocking trait to Blocking, and its ThreadHandle to ThreadHandle. This trait is going to gain more functionality. * Add the missing mention of `Blocking` to the docs for `Runtime`.
* tor-rtcompat: Rename BlockOn to ToplevelBlockOnIan Jackson2025-03-041-1/+1
| | | | | | | | | | We're going to distinguish top-level runtime entry, from *re*-entry to an existing executor. It is most convenient to rename this trait first. Documentation of the distinction will come later. (We're going to retain the function name `block_on`, but we want the trait to be more obviously a top-level only thing, though, so we give it a name that will hopefully avoid it peroulating throughout the codebase..)
* tor-rtcompat: Implement new_handle() using TcpSockFd.Gabriela Moldovan2025-01-151-1/+2
|
* tor-rtcompat: Add the ability to get a StreamOps handle.Gabriela Moldovan2025-01-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Needed for cases where we wrap an object that implements `StreamOps` in an external type, thereby losing access to the `StreamOps` functionality. For example, during the channel handshake, we `.split()` the stream that implements `StreamOps`, which leaves us with a `SplitSink` and a `SplitStream`, neither of which implement `StreamOps`. Getting a handle to the underlying object that implements `StreamOps` (for example, a file handle) *before* the stream is `.split()` enables us to use `StreamOps` to manipulate the underlying split stream. This commit also introduces a special `UnsupportedStreamOpsHandle`, which is a type that implements `StreamOps`, but always returns an error. This type is meant to simplify error handling and usage, and is meant to be used in cases where `StreamOps` is not supported. TODO: the name of this type is pretty confusing (it's very similar to `UnsupportedStreamOp`, which is an error type), and should probably be renamed to something else (`NoOpStreamOpsHandle`, `BrokenStreamOpsHandle`, `DummyStreamOpsHandle` come to mind...). Note: this changes the `StreamOps` trait to be slightly different from what I originally envisioned in !2660 and #1769
* tor-rtcompat: Use GAT instead of RPIT in SpawnBlocking trait.Wesley Aptekar-Cassels2025-01-071-1/+3
| | | | Due to the limitations on RPIT, it's better to use a GAT for now.
* tor-rtcompat: Add spawn_blocking to Runtime trait.Wesley Aptekar-Cassels2025-01-071-0/+10
| | | | | This adds a new SpawnBlocking trait, which exposes the spawn_blocking function that tokio, async-std, and other runtimes have.
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp (fmt).Gabriela Moldovan2024-12-101-2/+6
|
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp.Gabriela Moldovan2024-12-101-6/+2
|
* tor-rtcompat: Implement StreamOps for all the stream types.Gabriela Moldovan2024-12-101-2/+19
| | | | Part of #1769
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-291-4/+5
|
* rtcompat: Fix some rustdoc links.Nick Mathewson2024-09-241-2/+1
|
* rtcompat: Require Sync and 'static for NetStreamListener::IncomingNick Mathewson2024-09-241-1/+1
|
* rtcompat: NetStreamProvider<unix::SocketAddr> for non-unix platformsNick Mathewson2024-09-241-0/+3
| | | | | | | Since there is no way to construct a unix::SocketAddr on these platforms, it's harmless to provide an implementation for NetStreamProvider. What's more, doing so greatly simplifies our AbstractAddr implementation.
* Implement NetStramProvider<Unix> for async_std.Nick Mathewson2024-09-241-0/+23
|
* async_std: Perpare macro for use with Unix streams.Nick Mathewson2024-09-241-33/+33
|
* async_std: start a macro to implement wrappers for stream typeNick Mathewson2024-09-241-71/+79
| | | | | As before, this commit does nothing interesting: it's a separate commit because it reindents a lot of code.
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-7/+7
| | | | | | | | | | | | | | (And similarly rename TcpListener to NetStreamListener, along with their TcpStream/TcpListener associated types.) These types are about to become generic over addresses, and therefore shouldn't be named after TCP. Renaming was done mostly with Rust Analyzer, except for some macros that needed to be hand-edited. (I'll revise the comments in the next commit; this one is all about renaming.)
* rtcompat: Remove accept() from TcpListenerNick Mathewson2024-09-241-3/+0
| | | | | | | | | | It's redundant with the incoming() method (which turns the TcpListener into a Stream of connections), and nothing actually used it outside of tests. Removing this method allows us to simplify our TcpListener code a good deal, as can be seen by some of the implementations we removed from our example and testing code.
* tor-rtcompat: Require that TcpStream be SendIan Jackson2022-08-151-1/+1
| | | | The lack of this seems to have been an oversight.
* UdpSocket: remove support for connect().Nick Mathewson2022-03-181-20/+3
| | | | | | | | Currently, Arti doesn't need this. But once it does, it will be way better to have a separate type for connected sockets, rather than having to error-check every time somebody gives us a socket. Part of #410
* add simple unit test on UDPtrinity-1686a2022-03-141-0/+4
|
* add skeleton for DNS handlingtrinity-1686a2022-03-141-2/+2
|
* add udp to runtimetrinity-1686a2022-03-141-1/+46
|
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-1/+1
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* Refactor native_tls usage into its own moduleNick Mathewson2022-01-251-91/+0
| | | | | This change uses the async-native-tls crate for everything, and deletes some duplicated code.
* Refactor Runtimes to use separate TLS implementations internally.Nick Mathewson2022-01-191-1/+6
| | | | | This will make it easier to implement them using some other TLS provider as well, without having to duplicate all of our code.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-7/+5
| | | | | | | | | | | | | | | | | | | | `tor-rtcompat`'s `TlsConnector` trait previously included a method to create a TLS-over-TCP connection, which implied creating a TCP stream inside that method. This commit changes that, and makes the function wrap a TCP stream, as returned from the runtime's `TcpProvider` trait implementation, instead. This means you can actually override `TcpProvider` and have it apply to *all* connections Arti makes, which is useful for issues like arti#235 and other cases where you want to have a custom TCP stream implementation. This required updating the mock TCP/TLS types in `tor-rtmock` slightly; due to the change in API, we now store whether a `LocalStream` should actually be a TLS stream inside the stream itself, and check this property on reads/writes in order to detect misuse. The fake TLS wrapper checks this property and removes it in order to "wrap" the stream, making reads and writes work again.
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-1/+3
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* Fix typosJani Monoses2021-09-071-1/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+224
This will cause some pain for now, but now is really the best time to do this kind of thing.