summaryrefslogtreecommitdiff
path: root/crates/tor-proto
Commit message (Collapse)AuthorAgeFilesLines
* Bump arti- and tor- crates to 0.23.0Nick Mathewson2024-09-301-17/+17
| | | | | | | | | | | | | | Per our policy, every one of these gets a minor bump. Generated with: ``` for crate in $(./maint/list_crates | grep '^\(tor\|arti\)-' ); do cargo set-version --bump minor -p $crate; done ``` (Note the use of `-` at the end end of the grep pattern to prevent matching the `arti` crate.)
* Minor bumps on non-tor/arti cratesNick Mathewson2024-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates are not in the tor/arti namespace, but we have given them MSRV bumps: ``` oneshot-fused-workaround slotmap-careful fslock-guard hashx equix caret fs-mistrust safelog test-temp-dir retry-error ``` We are counting this as a breaking change. Since all of these crates are at 0.x.x, we have indicated the breaking change with a minor version bump. This commit was generated with the following script: ``` BUMPS=" oneshot-fused-workaround slotmap-careful fslock-guard hashx equix caret fs-mistrust safelog test-temp-dir retry-error " for crate in $BUMPS; do cargo set-version --bump minor -p $crate; done ```
* Merge branch 'msrv-1.77-and-rusqlite-update' into 'main'David Goulet2024-09-261-1/+1
|\ | | | | | | | | Upgrade MSRV to 1.77 , and rusqlite to 0.32.1 See merge request tpo/core/arti!2451
| * Upgrade MSRV to 1.77Nick Mathewson2024-09-251-1/+1
| | | | | | | | This will allow us to upgrade to the latest version of rusqlite.
* | Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-1/+1
|/ | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* Bump MSRV from 1.70 to 1.75.Wesley Aptekar-Cassels2024-09-161-1/+1
|
* tor-proto: Use Reader::take_all_but().Nick Mathewson2024-09-161-8/+1
|
* tor-bytes: Error: provide and call Error::incomplete_errorIan Jackson2024-09-111-1/+1
| | | | | | | | | | | | | | | | | | | We introduce the new constructor and call it at the error generation sites. But there is still not yet any functional change. Change the type of Truncated's field to be Sensitive. The original reason for not doing this no longer applies, since we don't generally want to open-code construction of this variant. Conveniently, changing the type means we get to find all the sites where one *is* constructed and adjust them. In reader.rs and tor-proto we can just call incomplete_error. In tor-cell, there's a call site where we previously provided an underestimate, and where the Reader isn't available. We adjust that ad-hoc but this is fine because the error variant will change. (relaycell is using a Reader from from_slice.)
* tor-bytes: Add a deficit field to Error::Truncated (fmt)Ian Jackson2024-09-101-1/+3
|
* tor-bytes: Add a deficit field to Error::TruncatedIan Jackson2024-09-101-1/+2
| | | | This will allow us to fix #1592, but it doesn't do so yet.
* Bump all the unstable tor- and arti- crates to 0.22.0.Gabriela Moldovan2024-09-031-17/+17
| | | | | | | | | | Done using: ``` for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.22.0 done ```
* oneshot-fused-workaround: Set the initial version to 0.1.0.Gabriela Moldovan2024-09-031-1/+1
| | | | This is the first time we're publishing this, so let's start at 0.1.0.
* Fix formatting issues introduced by fixup-features.Gabriela Moldovan2024-09-031-1/+3
|
* Run fixup-features in preparation for release.Gabriela Moldovan2024-09-031-1/+1
|
* Fix typosDimitris Apostolou2024-09-032-3/+3
|
* Move stream_peek into tor-async-utilsJim Newsome2024-08-292-6/+2
|
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-288-10/+10
| | | | | | | | | | | | | | 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.
* `tor_proto::channel`: update comment to point to `tor-chanmgr`Jim Newsome2024-08-271-2/+1
|
* `circuit` docs: delete comment about no flow-control etcJim Newsome2024-08-261-2/+0
| | | | | There is now (sendme-style) flow control, and some fairness (via round robin scheduling of streams).
* `circuit` docs: delete "one big mutex" limitationJim Newsome2024-08-261-3/+0
| | | | | | There is a mutex for some of the "mutable state", but the reactor only needs to lock it when adding a hop. It's not needed "to process a cell" or when streams send. Probably not worth calling out here.
* tor-proto circuit: add unit test for fairnessJim Newsome2024-08-221-0/+128
|
* flow-control: document idea for making more robustJim Newsome2024-08-212-0/+11
| | | | | From <https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2340#note_3062531>
* Circuit reactor: improve code commentsJim Newsome2024-08-211-3/+11
| | | | | In particular, clarify that stream-flow-control msgs don't get blocked on circuit congestion control.
* StreamPollSet: disallow polling ready streamsJim Newsome2024-08-212-30/+46
|
* StreamMap: Use StreamUnobtrusivePeeker instead of PeekableJim Newsome2024-08-212-4/+9
|
* tor-proto: Use PeekableStream to get rid of redundant bufferingJim Newsome2024-08-213-235/+303
| | | | | | | | | | | | | | | | | | | | | | | | | * Update `StreamPollSet` to require that its streams implement `PeekableStream`, and to not do its own buffering of values read from the stream. This avoids an extra layer of buffering for streams that already buffer a value, and makes the interior state a little simpler and more robust. It does have a downside of making the API a little less convenient, since the caller must do its own `poll_peek` call if it wants a reference to the item. * Update `StreamMap` to implement `PeekableStream` for `OpenStreamEntStream`, as it must to satisfy the updated `StreamPollSet` API. We have to somewhat constrain the `poll_ready_streams_iter` API to no longer return both a reference to the stream and the message. I don't see a way to return both while satisfying the borrow checker. Luckily we don't really need both anymore. * Update the Circuit reactor to handle the updated `StreamMap::poll_ready_streams_iter` API.
* Circuit reactor: Update comments about outbound message handlingJim Newsome2024-08-151-3/+7
|
* Circuit reactor: remove `'hop_streams` loopJim Newsome2024-08-131-33/+24
| | | | | | | | | | As clippy points out otherwise, this no longer actually loops. Since the iterator already guarantees that the messages it produces are ready to send with respect to flow control, and we've already validated that we can send with respect to the circuit window, the loop, we can always handle the first item from the iterator. i.e. this changes a `while let` to an `if let`.
* Circuit reactor: remove `'outer` loopJim Newsome2024-08-131-55/+50
| | | | This is no longer needed. Removing it shouldn't change any behavior.
* Circuit reactor: don't process streams when we don't have circuit windowJim Newsome2024-08-131-18/+11
| | | | | | | When we've exhausted circuit-level SENDME window, iterating over streams is likely to be a waste of CPU. Theoretically we might be able to send some messages that don't count towards windows, but on balance it doesn't seem worth it.
* StreamMap: apply stream flow control before making messages availableJim Newsome2024-08-132-17/+83
| | | | | | This prevents us from having to iterate over streams blocked on flow control inside the circuit reactor, and potentially allows further simplification.
* tor-proto: Encapsulate flow-controlJim Newsome2024-08-135-59/+132
| | | | | | Encapsulate flow-control into a separate object that partially abstracts away the difference between window-based (legacy) flow control and xon-based (prop324) flow control.
* Circuit reactor: remove unnecessary circ window precheckJim Newsome2024-08-131-21/+0
| | | | | | | | | Since we no longer have an outbound queue for each hop, and instead return an error here if there is insufficient circuit window to send a message, there's no need to pre-check whether we have sufficient window. If there's insufficient circuit window, we'll still return an error slightly later, after failing to take from the circuit window.
* StreamMap: rm stray commentJim Newsome2024-08-131-3/+0
|
* Merge branch 'streampollset-no-v' into 'main'David Goulet2024-08-132-24/+21
|\ | | | | | | | | StreamPollSet: remove redundant type parameter V See merge request tpo/core/arti!2334
| * StreamPollSet: remove redundant type parameter VJim Newsome2024-08-122-24/+21
| | | | | | | | | | This was required to be the same type as `S::Item`. We can just use `S::Item` directly.
* | tor-proto: removed CountedHashMapJim Newsome2024-08-122-542/+0
|/ | | | | | | | | | | This was written for use in StreamMap, with an eye towards potentially reusing it elsewhere. We no longer use it in StreamMap, so it's currently unused. Probably best to go ahead and remove it now and resurrect it if we decide we want it later than to maintain dead code (or to make it more widely available without more concrete use-cases).
* StreamPollSet: replace nested OptionJim Newsome2024-08-081-10/+28
| | | | | | | | | | | | | | | | | Bullied by clippy. I'm on the fence whether this is actually an improvement, or whether I should add an exception. ``` error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases --> crates/tor-proto/src/util/stream_poll_set.rs:106:56 | 106 | pub fn remove(&mut self, key: &K) -> Option<(K, P, Option<Option<V>>, S)> { | ^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option = note: `-D clippy::option-option` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_option)]` ```
* StreamMap: Merge rxs into open_streamsJim Newsome2024-08-082-72/+68
| | | | | | This simplifies the bookkeeping a bit, and clears a path towards updating the Streams in our StreamPollSet to directly respect flow control.
* StreamMap: Put open streams in their own map instead of CountedHashMapJim Newsome2024-08-082-137/+124
| | | | | | This temporarily results in *more* bookkeeping, but is a step towards putting the mpsc receivers back into `OpenStreamEnt`, and putting the whole `OpenStreamEnt`s into the `StreamPollSet`.
* StreamMap: test n_open_streamsJim Newsome2024-08-081-1/+13
|
* StreamPollSet: allow access to inner streamsJim Newsome2024-08-082-48/+345
|
* KeyedFuturesUnordered: explicitly document Stream behaviorJim Newsome2024-08-081-0/+13
|
* KeyedFuturesUnordered: return actual referencesJim Newsome2024-08-081-23/+10
| | | | | | We can actually return references here instead of `impl Deref`, simplifying this code a bit and follow-on code to use this in StreamPollSet.
* KeyedFuturesUnordered: additional testingJim Newsome2024-08-081-37/+98
| | | | | | | | | Primarily I wanted to exercise the code path that we get a spurious wakeup due to a future that was removed from the map later becoming ready. I also ended up merging ReadyFut and PendingFut into a more flexible ValueFut to make this a little nicer.
* Add KeyedFuturesUnordered::get and KeyedFuturesUnordered::get_mutJim Newsome2024-08-081-3/+72
|
* KeyedFuturesUnordered::remove: return the future as wellJim Newsome2024-08-082-18/+55
|
* KeyedFuturesUnordered: refactor so that futures are accessibleJim Newsome2024-08-082-100/+100
| | | | | | | | | | | Instead of wrapping `FuturesUnordered`, which doesn't support efficient access to its internal futures, keep the futures themselves in our own HashMap, and use a custom Waker to be notified which futures are ready to be polled. *Almost* a pure refactor in this step - the implementation now requires that keys are `Send + Sync + 'static` so that we can put them inside an `Arc` and send them over a channel.
* Merge branch 'docsrs' into 'main'Jim Newsome2024-08-071-1/+0
|\ | | | | | | | | | | | | Don't need to tell docs.rs to enable `docsrs` cfg. It does it automatically as of https://github.com/rust-lang/docs.rs/pull/2390#event-11664409098 While this change isn't in our MSRV yet, we were only using this when building for docs.rs, where we use the latest anyway. See merge request tpo/core/arti!2308
| * Don't need to tell docs.rs to enable `docsrs` cfgKunal Mehta2024-08-021-1/+0
| | | | | | | | | | It now does it automatically, see <https://docs.rs/about/builds#detecting-docsrs>.