summaryrefslogtreecommitdiff
path: root/crates/tor-proto
Commit message (Collapse)AuthorAgeFilesLines
* Bump all the unstable tor- and arti- crates to 0.19.Gabriela Moldovan2024-06-051-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unstable crates are: - tor-error - tor-config - tor-units - tor-geoip - tor-rtcompat - tor-rtmock - tor-log-ratelim - tor-rpcbase - tor-memquota - tor-llcrypto - tor-protover - tor-bytes - tor-hscrypto - tor-socksproto - tor-checkable - tor-cert - tor-linkspec - tor-cell - tor-proto - tor-netdoc - tor-consdiff - tor-netdir - tor-relay-selection - tor-persist - tor-chanmgr - tor-ptmgr - tor-guardmgr - tor-circmgr - tor-dirclient - tor-dirmgr - tor-keymgr - tor-hsclient - tor-hsservice - tor-hsrproxy - arti-client - arti-rpcserver - arti-hyper - tor-basic-utils - tor-async-utils Done using ``` for p in "${unstable[@]}"; do cargo set-version -p $p 0.19; done ``` where `unstable` contains the list above
* Merge branch 'poll-ready-unpin-bool' into 'main'Nick Mathewson2024-05-293-12/+28
|\ | | | | | | | | Tidy up the ChannelSender::poll_ready inherent method See merge request tpo/core/arti!2171
| * ChannelSender::poll_ready_unpin_bool: add otiose ext trait docIan Jackson2024-05-291-0/+1
| |
| * ChannelSender::poll_ready_unpin_bool: move to utilIan Jackson2024-05-293-20/+24
| | | | | | | | This is where it belongs.
| * ChannelSender::poll_ready_unpin_bool: extension traitIan Jackson2024-05-292-1/+8
| | | | | | | | | | | | | | This makes this available for any Sink + Unpin. Which we want because we're about to wrap our ChannelSender in a Sink wrapper. It's in the wrong place now; we'll move it in a moment.
| * ChannelSender::poll_ready_unpin_bool: rename from poll_readyIan Jackson2024-05-292-5/+9
| | | | | | | | | | | | | | | | | | | | This would otherwise shadow the poll_ready method, which is confusing. Also this paves the way for making it available for any Sink + Unpin. Improve the docs somewhat to explain what this thing actually is.
| * ChannelSender::poll_ready inherent method: Don't discard errorIan Jackson2024-05-291-1/+1
| | | | | | | | | | | | | | | | I think this error was in fact always Error::CircuitClosed because it came from ChannelClosed.into(). Anyway, we shouldn't squash it. Now this function has semantics identical to Sink::poll_ready, just a slightly different signature.
| * ChannelSender::poll_ready inherent method: Avoid apparent discardIan Jackson2024-05-291-1/+1
| | | | | | | | Make it clear we're discarding `()`, not an actual value.
| * ChannelSender::poll_ready inherent method: Use Sink:poll_readyIan Jackson2024-05-291-1/+1
| | | | | | | | | | | | | | | | | | We're going to change this function, but first we are going to make its behaviour identical to Sink::poll_ready. This avoids open-coding the call to poll_read on cell_tx. The error handling is still strange. We'll fix that in a moment.
* | proto: Try to clarify why StreamReader has a StreamTarget.Nick Mathewson2024-05-292-3/+10
| |
* | proto: Add a test for closing streams.Nick Mathewson2024-05-291-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | This test verifies that when we invoke the code to close a stream, an END message is actually sent. The test comes in two versions: * `drop_stream` closes the stream by dropping it. It currently passes on main. * `close_stream` closes the stream by running `AsyncWriteExt::close` on the writer. It is a regression test for #1368. It currently fails on main.
* | proto: Improve documentation about DataStream lifetimes and closingNick Mathewson2024-05-292-1/+40
| | | | | | | | | | | | | | In particular, clarify that dropping the DataWriter on its own does nothing unless the DataReader is also dropped. Related to #1368.
* | proto: Make DataWriter::close actually do something.Nick Mathewson2024-05-293-9/+41
|/ | | | | | | | | | | | | | | | | | | Previously we had a bug where `<DataWriter as AsyncWrite>::close` (or `shutdown` in tokio-land) would not actually have any effect. It _would_ drop the `StreamTarget` held by the `DataWriter`, but since the `DataReader` also held a `StreamTarget`, the MPSC channel would not get closed, and the circuit reactor would not realize that the stream wanted to shut down. Now we use `mpsc::Sender::close_channel` to make our closes effectual. Closes #1368. Additionally, we fix a bug where `poll_close()` never actually did anything if the buffer had nothing in it when it was called. Previously, `poll_flush_impl()` would exit immediately if it had no data to flush. That isn't what we want when we are closing!
* Remove an outdated comment.Nick Mathewson2024-05-201-3/+0
|
* Make an arc clone explicit.Nick Mathewson2024-05-201-1/+1
|
* Fix a typo.gabi-2502024-05-201-1/+1
|
* proto: Divide up some elements of ChannelDetails.Nick Mathewson2024-05-162-52/+58
| | | | | | | | | | | | | | Previously ChannelDetails had a double duty: It held elements shared among the clones of a Channel, and it also held elements shared between the Channel and the Reactor. But now that Channel doesn't have to implement Clone, we can more the non-Reactor elements into Channel itself. This change may improve cache locality a bit, and should make it a little easier to follow the channel code. I've also moved unique_id out of ChannelDetails into Channel _and_ Reactor: it is small, immutable, and used all the time in logging.
* Make Channel non-Clone.Nick Mathewson2024-05-162-2/+4
|
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-166-13/+21
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* proto: Move Channel send functionality into a separate type.Nick Mathewson2024-05-163-48/+70
| | | | | | | | | | | | This serves three purposes: * It removes the 'send a cell' method from the channel's public API. Nothing outside of tor-proto should have to use this. * It paves the way for giving each circuit a separate handle onto the channel's send functionality. This will eventually let the channel multiplex among circuits more intelligently. * It prepares for the next commit, which will make Channel itself universally Arc<.>ed.
* proto: Document ChannelDetails members that don't need to be shared.Nick Mathewson2024-05-161-1/+7
|
* proto: Document usage for each mutable part of ChannelDetailsNick Mathewson2024-05-161-1/+12
| | | | | For all mutable shared state, we ought to know which part of the program sets it, which part of the program reads it, and why.
* proto: Explicitly enforce maxima on SENDME windows.Nick Mathewson2024-05-143-5/+16
| | | | | | | | | | | | | | No actual bug here, just technical debt: For `SendWindow`s, our tag system already ensured that we rejected any SENDME that didn't correspond to an appropriate drain. Still, it doesn't hurt to check. For `RecvWindow`s, it would have been a protocol violation if we ever did this, but it makes sense to make it an internal error if we try. Part of #1383.
* proto: Fix compilation with stream-ctrl but not experimental-api.Nick Mathewson2024-05-142-2/+2
|
* proto: Expose wait_for_connection as a part of the DataStream API.Nick Mathewson2024-05-091-1/+1
|
* Merge branch 'new_ci_cfg_strategy' into 'main'Nick Mathewson2024-05-071-2/+2
|\ | | | | | | | | | | | | add_warning/CI: New strategy to avoid "unexpected-cfgs" warning Closes #1395 See merge request tpo/core/arti!2129
| * Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | | | | | This commit is automatically generated.
* | Circuit reactor: use refutable let to unnest some codeJim Newsome2024-05-061-34/+35
| |
* | Circuit reactor: rename 'hop to 'hop_outboundJim Newsome2024-05-061-3/+3
| | | | | | | | | | It was a bit misleading since it doesn't cover all processing for the hop.
* | Circuit reactor run_once: remove a level of nestingJim Newsome2024-05-061-27/+27
| | | | | | | | | | | | | | Get rid of an `if` block by changing the guarded loop to check its conditions at the beginning of the loop instead of the end. This is a slight behavior change, since previously channel readiness wasn't checked before the first iteration of the loop.
* | circuit reactor run_once: remove a level of nestingJim Newsome2024-05-061-90/+87
|/ | | | | | This should be a pure refactor. We remove a large if block and modify the first loop inside it to check whether the channel is ready before each attempt to send a message instead of after.
* Bump versions of 0.x tor-* and arti-* cratesIan Jackson2024-04-301-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for p in `cat ../u`; do cargo set-version --locked --offline -p $p; done where u contains tor-basic-utils tor-async-utils tor-error tor-config tor-units tor-geoip tor-rtcompat tor-rtmock tor-log-ratelim tor-rpcbase tor-memquota tor-llcrypto tor-protover tor-bytes tor-hscrypto tor-socksproto tor-checkable tor-cert tor-linkspec tor-cell tor-proto tor-netdoc tor-consdiff tor-netdir tor-relay-selection tor-persist tor-chanmgr tor-ptmgr tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr tor-keymgr tor-hsclient tor-hsservice tor-hsrproxy arti-client arti-rpcserver arti-hyper
* Circuit reactor: document some requirements and assumptionsJim Newsome2024-04-251-10/+42
| | | | | | | | There are some tricky bits here that implicitly assume particular behavior in other bits for correctness. Document these requirements and assumptions. Fixes arti#1373
* Add temporary allows for some dead code warningsIan Jackson2024-04-253-0/+3
|
* Use uXX::MAX in place of std::uXX::MAXNick Mathewson2024-04-222-3/+3
| | | | | | The old code produced a warning from clippy nightly; we may as well update to use the new associated consts. (They've been there since Rust 1.4x.)
* proto: Simplify a check-and-convert to use try_into+expectNick Mathewson2024-04-221-2/+2
|
* Merge branch 'counted_hashmap' into 'main'Ian Jackson2024-04-112-42/+565
|\ | | | | | | | | | | | | streammap: Use an internal counted_hashmap to simplify invariant checking Closes #1344 See merge request tpo/core/arti!2058
| * counted_map: Use educe(Default).Nick Mathewson2024-04-021-12/+4
| |
| * counted_map: Use PhantomData<fn(P)->P>Nick Mathewson2024-04-021-4/+4
| | | | | | | | This is always Send+Sync, and invariant with P.
| * counted_map: Add some notes about correctness; downgrade unsafesNick Mathewson2024-04-022-13/+21
| | | | | | | | | | (We're letting the "unchecked" suffix of this function be enough to indicate that it's risky to use.)
| * streammap: Use an internal counted_hashmap to simplify invariant checkingNick Mathewson2024-03-282-43/+566
| | | | | | | | | | | | | | | | | | | | Instead of making `streammap.rs` responsible for keeping track of a count field, this lowers that functionality into a lower-level CountedHashMap type. Said type has a little more functionality than we need, to sketch out how we'd want to develop it moving forward if we find that it's useful elsewhere. Closes #1344.
* | remove unused dependenciestrinity-1686a2024-04-021-2/+0
| | | | | | | | Edited-by: Nick Mathewson <[email protected]>
* | Update unstable `tor/arti-*` crates to 0.17.0.Nick Mathewson2024-04-021-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done with: ``` CRATES=" tor-basic-utils tor-async-utils tor-error tor-config tor-events tor-units tor-geoip tor-rtcompat tor-rtmock tor-log-ratelim tor-rpcbase tor-llcrypto tor-protover tor-bytes tor-hscrypto tor-hspow tor-socksproto tor-checkable tor-cert tor-linkspec tor-cell tor-proto tor-netdoc tor-consdiff tor-netdir tor-relay-selection tor-congestion tor-persist tor-chanmgr tor-ptmgr tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr tor-keymgr tor-hsclient tor-hsservice tor-hsrproxy arti-client arti-rpcserver arti-config arti-hyper arti-bench arti-testing " for crate in $CRATES; do cargo set-version -p "$crate" 0.17.0 done ```
* | Bump patchlevel versions on non-{tor/arti} crates.Nick Mathewson2024-04-021-1/+1
|/ | | | | | | | | | | | | | | | These have all had backward-compatible changes. Generated with: ``` cargo set-version --bump patch -p fs-mistrust cargo set-version --bump patch -p test-temp-dir cargo set-version --bump patch -p fslock-guard cargo set-version --bump patch -p hashx cargo set-version --bump patch -p equix cargo set-version --bump patch -p caret cargo set-version --bump patch -p safelog cargo set-version --bump patch -p retry-error ```
* Make filter conditional, to fix build with hs-service disabled.Nick Mathewson2024-03-262-2/+6
|
* Refactor and simplify ClientCircSyncViewNick Mathewson2024-03-262-34/+24
| | | | | | | | With this patch, it holds only a reference to `&reactor.hops`, which greatly simplifies the reactor code's fight with the borrow checker. I've left some TODO comments about future directions here.
* Rename the old IncomingStreamRequestContext to StreamReqInfo.Nick Mathewson2024-03-263-9/+7
| | | | (Doing this to prevent us having two structs with the same name.)
* Add an IncomingStreamRequestFilter to check early propertiesNick Mathewson2024-03-265-12/+136
| | | | | | | Based on designs in #1124. Note that there is a TODO here about a hack I had to do to appease the borrow checker.
* Define a type for a synchronous (blocking) view of a circuit state.Nick Mathewson2024-03-263-0/+40
| | | | | We'll use this as an argument for the callback that checks stream requests to make sure they're permitted.
* proto: Make StreamMap keep a count of open streams.Nick Mathewson2024-03-261-0/+34
|