summaryrefslogtreecommitdiff
path: root/crates/tor-rtmock
Commit message (Collapse)AuthorAgeFilesLines
* Bump all the unstable tor- and arti- crates to 0.29.0.Gabriela Moldovan2025-03-311-7/+7
| | | | | | | | | | Done using: ``` for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.29.0 done ```
* Upgrade strum dependency to 0.27.1.Gabriela Moldovan2025-03-271-1/+1
| | | | | | | | | In 0.27.0, strum's MSRV was bumped to 1.66.1, but that's okay because ours is 1.77. We aren't affected by any of its [breaking changes]. [breaking changes]: https://github.com/Peternator7/strum/blob/master/CHANGELOG.md#0270
* 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.
* Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | | | (Per discussion at #1774, we think the changes are acceptable.) This commit won't compile on its own; subsequent commits will fix it.
* tor-rtmock: Add since= to deprecateds (formatting)Ian Jackson2025-03-061-1/+2
|
* tor-rtmock: Add since= to deprecatedsIan Jackson2025-03-062-2/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2843#note_3169975
* tor-rtmock: Fiddle with a comment formatIan Jackson2025-03-061-2/+3
| | | | For some reason rustfmt wants to mess with this. Forestall it.
* tor-rtmock: Actually apply deprecated attr to deprecated time.rsIan Jackson2025-03-065-5/+36
|
* tor-rtcompat: Rename spawn_thread to spawn_blockingIan Jackson2025-03-042-9/+9
| | | | Let's use Tokio terminology here.
* tor-rtcompat: Remove the TODO re #1835Ian Jackson2025-03-041-3/+0
| | | | This is the TODO we are fixing with this MR.
* tor-rtcompat: Explain Sendness of reenter_block_on futureIan Jackson2025-03-041-0/+1
| | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2810#note_3167975 Also allow ourselves the option of changing this in the future.
* tor-rtmocK; Detect wrong-context blocking_io and spawn_threadIan Jackson2025-03-042-0/+20
|
* tor-rtmock: Split out spawn_thread_innerIan Jackson2025-03-041-5/+16
| | | | | This will let us call _inner from blocking_io, with a different precondition. No functional change.
* tor-rtmocK; Detect re-entry into MockExecutorIan Jackson2025-03-041-6/+29
|
* tor-rtmock: task: Remove Default impl for ThreadDescriptorIan Jackson2025-03-042-4/+5
| | | | | | | | | This is going to become a hazard. Let's be explicit. This means using educe to derive the Default for Data. We also need to update our educe dependency to 0.4.22, since that's when Default(expression= "...") started working correctly.
* tor-rtmock: Split out executor_main_loopIan Jackson2025-03-041-3/+11
| | | | | | | | execute_until_first_stall is now simply a wrapper which does some logging. It will do a bit more in a moment. Giving the inner function a more obvious name is helpful, since the executor main loop is a thing one is often looking for.
* tor-rt*: Apply deferred formatting churnIan Jackson2025-03-042-4/+5
| | | | rustfmt.
* tor-rtcompat: Remove ToplevelBlockon from RuntimeIan Jackson2025-03-044-3/+16
| | | | | | | | 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.
* tor-rtcompat: Provide a new function for executor re-entryIan Jackson2025-03-042-0/+16
| | | | | | | | | | | | | | | 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-042-15/+15
| | | | | | | | | | | | | | | * 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-043-8/+10
| | | | | | | | | | 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-rtmock: Correct a commentIan Jackson2025-03-041-1/+1
| | | | The MockExecutor doesn't have a threadpool.
* Bump minor versions in tor-*, arti-*.Nick Mathewson2025-03-031-7/+7
|
* Upgrade to derive_more 2Nick Mathewson2025-02-261-1/+1
| | | | | This took a little refactoring, since derive_more::Foo no longer re-exports std::ops::Foo.
* tor-rtmock: Avoid confusing "concurrently" wordIan Jackson2025-02-251-2/+2
|
* tor-rtmock: Explain Subthreads and compare them with bare threadsIan Jackson2025-02-251-0/+31
|
* tor-rtmock: Capitalise Subthread and link to the definitionIan Jackson2025-02-251-25/+29
| | | | | This makes it clearer that this is a specific term, which a definition.
* tor-rtmock: Fix a typoIan Jackson2025-02-251-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2793#note_3161972
* tor-rtmock: Move imprecations to more prominent locationIan Jackson2025-02-251-11/+9
| | | | | The rustdocs for a fn in a trait impl are rendered, but are very unobvious. Put the information in the top-level documentation.
* tor-rtmock: subthread facilityIan Jackson2025-02-131-7/+381
| | | | We'll expose this with some new traits in tor_rtmock.
* tor-rtmock: subthread facility (pre-fmt)Ian Jackson2025-02-131-2/+10
|
* tor-rtmock: Replace open-coded Debug impl with DeriveIan Jackson2025-02-131-34/+27
| | | | | | | No change to output, but much less open-coding. Move the doc comment that was on the Debugg impl, to the `DebugTasks` helper struct.
* tor-rtmock tests: Improve various_mock_executorsIan Jackson2025-02-131-0/+1
| | | | Show where each test sub-case is started, in stderr output.
* tor-rtmock tests: Break out various_mock_executorsIan Jackson2025-02-131-5/+10
| | | | We're going to add another call site.
* tor-rtmock: Break out Task::set_awakeIan Jackson2025-02-131-7/+19
| | | | We're going to add another call site.
* tor-rtmock: task: Rename MockExecutor Arc<Shared> field to sharedIan Jackson2025-02-131-17/+17
|
* tor-rtmock: task: Replace ArcMutexData with Arc<Shared>Ian Jackson2025-02-131-12/+20
| | | | | | | | | | | | | We're going to want to add a field inside the Arc but not inside the Mutex, so make the Arc contents into a named-fields struct. We don't need ArcMutexData any more. Arc<Shared> will do fine. Previously, we needed to implement .lock() on ArcMutexData but because Arc<Shared> derefs to Shared, we can implement it on Shared just as well. The field in MockExecutor ought to be renamed, but that's textually intrusive so will come in the next commit.
* tor-rtmock: Correct a commentIan Jackson2025-02-131-1/+1
| | | | | In an earlier version of this code there was a Polling state, but there isn't now.
* Enable derive-deftly beta featuresIan Jackson2025-02-121-1/+1
| | | | | | | | Right now this will give us `${Xmeta as ... default ...}`, which may improve things in the future. The Cargo.toml syntax is precisely that from https://docs.rs/derive-deftly/1.0.0/derive_deftly/doc_changelog/index.html#t:beta
* Update to derive-deftly 1.0Ian Jackson2025-02-121-1/+1
| | | | | | | | | This is released now. Prepared with: cargo upgrade -i -p derive-deftly There is some new duplication now I think mostly because pwd-grp uses old derive-deftly.
* Version bumps to 0.27.0Ian Jackson2025-02-061-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See Release.md. maint/list_crates | grep -P '^tor-|^arti-' | xargs -n1 nailing-cargo -Eu set-version --bump minor -p This completes the version bumps. The report of changed crates, before I started the release work, is: $ maint/changed_crates -v "arti-v$LAST_VERSION" oneshot-fused-workaround: No change. slotmap-careful: No change. test-temp-dir: No change. fslock-guard: No change. hashx: No change. equix: No change. tor-basic-utils: No change. caret: No change. fs-mistrust safelog: No change. retry-error: No change. tor-error tor-general-addr: No change. tor-geoip: No change. tor-rtcompat tor-rtmock tor-async-utils tor-config tor-config-path tor-rpc-connect tor-log-ratelim: No change. tor-rpcbase tor-memquota: No change. tor-units tor-llcrypto: No change. tor-protover: No change. tor-bytes tor-checkable: No change. tor-cert tor-key-forge tor-hscrypto: No change. tor-socksproto: No change. tor-linkspec: No change. tor-cell: No change. tor-proto tor-netdoc: No change. tor-consdiff: No change. tor-netdir tor-relay-selection: No change. tor-persist tor-chanmgr tor-ptmgr: No change. tor-guardmgr: No change. tor-circmgr tor-dirclient: No change. tor-dirmgr: No change. tor-keymgr tor-hsclient tor-hsservice tor-hsrproxy: No change. tor-relay-crypto arti-client arti-relay arti-rpcserver arti arti-rpc-client-core $
* 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
|