aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src/net_runtime.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-rtcompat: Remove ToplevelBlockon from RuntimeIan Jackson2025-03-041-0/+1
| | | | | | | | Introduce ToplevelRuntime as an alias, and use it in the top-level programs. Now none of the principal protocol implementation code has access to the executor's toplevel entrypoint, and can't call it by mistake.
* Switch to derive-deftlyIan Jackson2024-04-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* tor-rtmock: Use derive-adhoc for composite runtimesIan Jackson2023-07-071-8/+4
|
* tor-rtmock: Use the same specified field for BlockOn and SpawnIan Jackson2023-07-061-2/+1
| | | | These are always the same and probably always will be.
* tor-rtmock: net: "Provide" a UDP "implementation" which doesn't workIan Jackson2023-07-061-1/+0
| | | | | | | | | | Nothing in our tree actually *uses* the UDP in tests. We want a mock UDP provider that isn't part of a real runtime, so that we can make a totally-mock runtime for properly controlled testing. It seems best to make this part of MockNetProvider rather than a separate type.
* tor-rtmock: Introduce impl_runtime_preludeIan Jackson2023-07-061-8/+2
| | | | | This deduplicates some imports, which would otherwise be about to become triplicated.
* tor-rtmock: Introduce impl_runtime! macroIan Jackson2023-07-061-56/+7
| | | | | | | This deduplicates some trait delegation. We want this now because we're about to introduce a third mock runtime, so this would become triplication otherwise.
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-1/+1
| | | | | | | | | | | | | | - arti#445 highlighted the lack of good documentation around Arti's multiple runtime support, as well as it being difficult to determine what runtime was actually in use. - Improve the documentation to solve the first problem. - To solve the second problem, make Runtime require Debug (which is arguably a good idea anyway, since it makes them easier to embed in things), and print out the current runtime's Debug information when arti is invoked with `--version`. - (It also prints out other Cargo features, too!) fixes arti#445
* add udp to runtimetrinity-1686a2022-03-141-2/+13
|
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-2/+2
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-3/+4
| | | | | | | | | | | | | | | | | | | | `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/+2
| | | | | | | | 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.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+87
This will cause some pain for now, but now is really the best time to do this kind of thing.