summaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src
Commit message (Collapse)AuthorAgeFilesLines
* fix: fix typosDimitris Apostolou2025-01-301-1/+1
|
* tor-rtcompat: Rename UnsupportedStreamOps to NoOpStreamOpsHandle.Gabriela Moldovan2025-01-151-1/+1
| | | | | This renames UnsupportedStreamOpsHandle to NoOpStreamOpsHandle for clarity (the old name kind of sounded like the name of an error type).
* tor-rtmock: Implement StreamOps for MockTlsStream (fmt).Gabriela Moldovan2025-01-151-1/+3
|
* tor-rtmock: Implement StreamOps for MockTlsStream.Gabriela Moldovan2025-01-151-1/+14
| | | | | We're about to add a trait bound that forces `MockTlsStream` to impl `StreamOps`.
* tor-rtmock: drop_reentrancy test: Run under miri tooIan Jackson2025-01-151-8/+14
|
* tor-rtmock: Explicitly manage the lifetime of the futureIan Jackson2025-01-151-0/+7
| | | | | | | | | | | Previously, if r is Pending, `fut` is moved out of (stored in `task.fut`), whereas if r is Ready, it is retained and then dropped at the end of the loop iteration. This is quite subtle, and involves `fut` being in a "maybe moved out of" state (which cannot be represented in Rust's surface type system) after the block with the `data` lock. Let's write code that more clearly ensures that the compiler DTRT.
* tor-rtmock: Add a test case for Future drop entrancyIan Jackson2025-01-151-0/+34
| | | | | This passes right now, but only because the lifetime of the `fut` variable in `execute_until_first_stall` happens to be right.
* tor-rtmock: Avoid misleading task dumps by careful drop sequencingIan Jackson2025-01-151-9/+34
|
* tor-rtmock: Add some more tracing / debug outputIan Jackson2025-01-151-1/+9
|
* tor-rtmock: Explain a difficulty with test trace outputIan Jackson2025-01-151-0/+5
|
* tor-rtcompat: Use GAT instead of RPIT in SpawnBlocking trait.Wesley Aptekar-Cassels2025-01-072-4/+9
| | | | Due to the limitations on RPIT, it's better to use a GAT for now.
* tor-rtmock: Add task names for spawn_obj and spawn_blocking.Wesley Aptekar-Cassels2025-01-071-2/+2
|
* tor-rtcompat: Add spawn_blocking to Runtime trait.Wesley Aptekar-Cassels2025-01-072-2/+47
| | | | | This adds a new SpawnBlocking trait, which exposes the spawn_blocking function that tokio, async-std, and other runtimes have.
* Merge branch 'mod-module-files' into 'main'Nick Mathewson2025-01-071-0/+1
|\ | | | | | | | | clippy: deny `mod_module_files` See merge request tpo/core/arti!2689
| * clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | | | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* | fix: fix typosDimitris Apostolou2025-01-061-2/+2
|/
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp (fmt).Gabriela Moldovan2024-12-101-1/+4
|
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp.Gabriela Moldovan2024-12-101-7/+3
|
* tor-rtcompat: Implement StreamOps for all the stream types.Gabriela Moldovan2024-12-101-1/+12
| | | | Part of #1769
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-291-6/+6
|
* Convert a few crates to slotmap-carefulNeel Chauhan2024-10-172-5/+5
|
* tor-rtmock: Provide and use an mpsc::channel wrapper in tor-rtmockIan Jackson2024-10-153-3/+17
|
* tor-rtmock: Add some commentary about SleepLocationIan Jackson2024-10-081-0/+6
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2502#note_3090557
* tor-rtmock: Simplify two cfgIan Jackson2024-10-082-2/+1
| | | | | | Discussion here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2502#note_3090554 https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2502#note_3090556
* tor-rtmock: Fix a memory leakIan Jackson2024-10-081-6/+20
| | | | | | Change the waker to have a weak reference to the executor. Detected by miri.
* tor-rtmock: miri: disable tests that use wallclock timeIan Jackson2024-10-084-3/+11
|
* tor-rtmock: Provide a fake SleepProvider for miriIan Jackson2024-10-081-0/+16
|
* tor-rtmock: Disable dead code warnings when not in a full buildIan Jackson2024-10-081-0/+3
|
* rtcompat: Expose FakeStream and friends; fix compilation in tor-rtmockNick Mathewson2024-09-241-7/+4
| | | | | It turns out that these types are generally useful, and that they are in fact needed for tor-rtmock to compile without a PreferredRuntime.
* rtcompat: remove async_trait from NetStreamListener.Nick Mathewson2024-09-241-1/+0
| | | | (The trait no longer has any async methods.)
* Make Runtime require NetStreamProvider<unix::SocketAddr>Nick Mathewson2024-09-241-0/+16
|
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-242-3/+4
| | | | | | 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-242-16/+16
| | | | | | | | | | | | | | (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-242-17/+12
| | | | | | | | | | 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.
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-282-2/+3
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* Match previous backtrace formattingRobin Leander Schröder2024-08-081-1/+1
| | | | | std::backtrace::Backtrace's Display looks the same as backtrace_rs::Backtrace's Debug
* Use std::backtrace instead of backtrace crateRobin Leander Schröder2024-08-011-33/+8
| | | | | Removes resolve_backtraces from rtmock since it is no longer needed as stdlib's backtraces automatically lazily resolve without needing a &mut.
* tor-rtmock docs: Add some more discussion of the simulated timeIan Jackson2024-07-301-1/+17
|
* tor-rtmock docs: We have CoarseTimeProvider nowIan Jackson2024-07-301-2/+3
| | | | Improve/replace some out-of-date notes in the docs.
* tls: Support export keying material (RFC 5705)David Goulet2024-06-182-0/+15
| | | | | | | | | | | | | 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]>
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-172-2/+2
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Suppress a spurious dead code lintIan Jackson2024-04-251-0/+1
|
* tor-rtmock: Remove a todo commentIan Jackson2024-04-031-5/+0
| | | | derive-deftly 0.10.x rejects unrecognised `#[deftly]` attributes.
* Switch to derive-deftlyIan Jackson2024-04-035-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Change word in commentIan Jackson2024-04-021-1/+1
| | | | | This was incorrect usage, as pointed out in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2052#note_3012727
* tor-rtmock: Use MockTimeCore in time.rs too (fmt)Ian Jackson2024-03-251-6/+12
|
* tor-rtmock: Use MockTimeCore in time.rs tooIan Jackson2024-03-251-23/+18
|
* tor-rtmock: Introduce MockTimeCoreIan Jackson2024-03-252-25/+82
| | | | | | | | | | | | | It bothered me that when I added a `MockCoarseTimeProvider` to the mock time providers, I had to manually grep to check that there weren't places the time was updated where I ought to also update the coarse time. Prove that the code is right by hiding all the times together in a struct that prevents un-synchronised updates. This is part 1, where we move the fields from simple_time::State to the new struct.