summaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/compound.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-rtcompat: BlockOn: relax bounds on reenter_block_onIan Jackson2025-04-091-1/+1
| | | | The future no longer needs to be `Send + 'static`.
* tor-rtcompat: Rename spawn_thread to spawn_blockingIan Jackson2025-03-041-2/+2
| | | | Let's use Tokio terminology here.
* tor-rtcompat: CompoundRuntime: Rename TaskR member from SpawnRIan Jackson2025-03-041-40/+39
| | | | | | This member is the principal one which implemnets Spawn, Blocking and perhaps ToplevelBlockOn. It doesn't appear that we actually need to split this into multiple members.
* tor-rtcompat: Provide Blocking::blocking_ioIan Jackson2025-03-041-0/+9
| | | | | | | | | This was referenced and explained from the docs, but didn't exist yet. Here it is. Everyone except the Tokio glue, and the CompoundRuntime, just use the default implementation in terms of spawn_thread. spawn_thread has a more relaxed contract, so this is correct.
* tor-rtcompat: Provide a new function for executor re-entryIan Jackson2025-03-041-1/+13
| | | | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | * 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-3/+3
| | | | | | | | | | 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: Big invasive change adding StreamOps bound everywhere.Gabriela Moldovan2025-01-151-0/+1
| | | | | | This is unfortunately necessary, because after the channel handshake, we need to give the channel reactor a `StreamOps` handle to the underlying stream.
* 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/+22
| | | | | This adds a new SpawnBlocking trait, which exposes the spawn_blocking function that tokio, async-std, and other runtimes have.
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-291-1/+1
|
* rtcompat: Fix some rustdoc links.Nick Mathewson2024-09-241-2/+3
|
* rtcompat: Add NetStreamProvider<Unix> to CompoundRuntimeNick Mathewson2024-09-241-32/+80
|
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-241-4/+5
| | | | | | Stop referring to TCP streams in its documentation; update other documentation to refer to NetStreamProvider rather than TcpProvider.
* 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: Add an extension trait for building modified RuntimesNick Mathewson2024-09-241-0/+67
| | | | | | | With this extension trait, we no longer need to construct `CompoundRuntime` directly outside of tor-rtcompat. This in turn will make it a little less painful when we have to add more generics to CompoundRuntime.
* tls: Support export keying material (RFC 5705)David Goulet2024-06-181-0/+5
| | | | | | | | | | | | | Add a function to get the keying material as detailed by RFC 5705. Because native-tls doesn't have such support, there is a place holder panic!() for now. This means that for the forseable future, relay would only work with rustls until we figure out a solution for native-tls. Closes #1432 Signed-off-by: David Goulet <[email protected]>
* tor-rtcompat: CompoundRuntime: Add a CoarseTimeProvider, and impl (fmt)Ian Jackson2024-03-251-4/+15
|
* tor-rtcompat: CompoundRuntime: Add a CoarseTimeProvider, and implIan Jackson2024-03-251-17/+44
| | | | | | In all the uses in-crate, this is just a RealCoarseTimeProvider. Now all the compound runtimes impl CoarseTimeProvider.
* tor-rtcompat: Reformat a doc comment for semantic newlinesIan Jackson2024-03-251-3/+3
|
* tor-rtcompat: use track-caller for thin wrappersJim Newsome2023-12-181-0/+2
| | | | | | | | | | | | | | In particular, when the (unstable) tokio tracing feature is enabled, every tracing line includes the name of where the current task was created. Without this change, that ends up being the name of intermediate trait methods like TokioRuntimeHandle::block_on, which is not very helpful. Adding the `track_caller` attribute causes the name of the caller of these methods to be used instead, which is typically more helpful. IIUC this change is not breaking in terms of semver https://rustc-dev-guide.rust-lang.org/backend/implicit-caller-location.html.
* Add an exception for clippy::arc_with_non_send_sync.Nick Mathewson2023-07-101-0/+1
| | | | We're doing this deliberately, I believe.
* rt-compat: Make all the individual runtime traits Clone+Send etc.Ian Jackson2022-06-081-0/+11
| | | | | | | | This will make it much more convenient for code that only wants one of these traits (or a subset of them). This is a good thing to support because it will allow us to use a ZST in places that do not need an actual async runtime handle (typically, the runtime handle is needed only for spawn).
* tor-rtcompat: make CompoundRuntime handle SleepProviders properlyeta2022-05-101-0/+11
| | | | | | Previously, CompoundRuntime would use the default implementations of SleepProvider::now() and ::wallclock(), instead of using its wrapped SleepProvider. This mildly embarrassing omission has been rectified.
* add udp to runtimetrinity-1686a2022-03-141-11/+39
|
* Replace manual Clone impl with educe in tor-rtcompatIan Jackson2022-03-021-10/+3
|
* tor-rtcompat: Provide TLS wrapping for all streamsIan Jackson2022-02-241-3/+2
| | | | | | | | Now all of the runtime types we provide all impl<S> TlsProvider<S> where S: ... rather than merely TlsProvider<Self::TcpStream>. And we document and intent to perhaps require this in the future.
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-4/+4
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* Limit the inner types in tor-rtcompat that have to implement CloneNick Mathewson2022-01-261-1/+10
| | | | | If we implement our own clone on CompoundRuntime, we no longer need Clone implementations on our TlsProvider implementations.
* Add a CompoundRuntime type for runtime construction.Nick Mathewson2022-01-191-0/+131
This type can solve two problems at once. First, it lets users replace parts of an existing runtime implementation without replacing the whole thing. For example, you can use it to override your TcpProvider implementation to solve problems like #235. Second, we can use it internally to tor-rtcompat to define Runtimes piece-by-piece. Mostly we'll use this to separate our Tls implementations from our implementations of the rest of the Runtime.