aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-rpcserver/src/connection.rs
Commit message (Collapse)AuthorAgeFilesLines
* rpc: Propagate and use LookupErrors.Nick Mathewson2026-04-131-2/+5
|
* rpc: Adjust invoke_rpc_method API and related lookups.Nick Mathewson2026-04-131-4/+1
| | | | | | | | | | | | The important thing here is that we need to look up the object _after_ we invoke any non-dispatched methods, since the object might be an expired weak reference. This required some related changes to tests and error types. Additionally, it required us to change the return value of Context::remove, since we can remove objects that are not completely present.
* rpc: Add context support for adding and removing weak refsNick Mathewson2026-04-131-17/+26
|
* rpc: collapse GenIdx enum to its single variant.Nick Mathewson2026-04-131-4/+0
|
* rpc: Do not allow a connection to be authenticated twiceNick Mathewson2026-03-161-6/+22
| | | | This makes it a little easier to drop unwanted capabilities.
* rpc: Move responsibility for Session creation to ConnectionNick Mathewson2026-03-161-27/+16
| | | | | The Connection will know the options that the listener was created with, as opposed to RpcMgr, which is the same for every listener.
* Remove a spurious debug_assert in arti-rpcserver.Nick Mathewson2026-01-121-1/+0
| | | | | | | This should never have been retained when we refactored our channels for reporting responses into a single channel. The bug became apparent when quicktest became derived from debug.
* rpc: Clean up GlobalId decoding API.Nick Mathewson2025-08-271-9/+6
|
* rpc: Cleanups to GlobalId tag byte handling.Nick Mathewson2025-08-271-1/+1
|
* Tag byte corrections and don't crashNeel Chauhan2025-08-271-8/+2
|
* '$' as tag byteNeel Chauhan2025-08-271-1/+1
|
* Update docsNeel Chauhan2025-08-271-3/+2
|
* Use a 'G' prefixNeel Chauhan2025-08-271-2/+2
|
* arti-rpcserver: Check IDs with a tag byte, not a magic lengthNeel Chauhan2025-08-271-3/+7
| | | | Edited-by: Nick Mathewson <[email protected]>
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-6/+6
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* rpcserver: Remove a stale TODO about ConnectionId.Nick Mathewson2025-01-281-3/+0
| | | | Other parts of the crate no longer look at the .0 field directly.
* Merge branch 'rpc-references-cleanup' into 'main'Nick Mathewson2025-01-281-15/+0
|\ | | | | | | | | rpc: Move support for weak references behind an experimental feature See merge request tpo/core/arti!2742
| * rpc: Move support for weak references behind an experimental featureNick Mathewson2025-01-271-15/+0
| | | | | | | | | | We haven't decided how these should work (see #868), so having them present by default is a bad idea.
* | rpcbase: Enforce validity on error datum keywords.Nick Mathewson2025-01-271-1/+2
|/
* rpc: Correct RPC error code for "RequestNotFound".Nick Mathewson2025-01-221-1/+4
|
* cancel: Distinguish the internal-error case for double-cancel.Nick Mathewson2025-01-221-2/+23
|
* rpc: Make cancel requests uncancellable.Nick Mathewson2025-01-221-25/+54
| | | | | | | | | The current cancel code is prone to deadlock, so the easiest way to solve it appears to be making cancel requests themselves uncancellable. I've included a test to verify the behavior; previously, this test caused a deadlock.
* rpc: Implement the rpc:cancel command.Nick Mathewson2025-01-161-1/+35
|
* rpc: Better RpcErrorKind for for RequestCancelled.Nick Mathewson2025-01-161-4/+7
|
* arti-rpcserver: Tell connections what kind of auth to expect.Nick Mathewson2025-01-151-0/+5
|
* Implement banner for RPC protocol.Nick Mathewson2025-01-091-2/+12
| | | | Closes #1753
* rpc: Tweak release_owned to give an error on second removal of "connection".Nick Mathewson2024-10-231-16/+20
|
* rpc: Use a const for the "connection" object ID.Nick Mathewson2024-10-231-2/+9
|
* rpc: Simplify method-dispatch-bypass logic a bitNick Mathewson2024-10-231-5/+2
| | | | | | | | | | | | | | | This commit removes the separate function for asking whether to bypass the dispatch code. Instead, it gives the "invoke with bypass" function an error to return when no dispatch is warranted, and moves the whole responsibility for method dispatch or non-dispatch back into tor-rpcbase. I had to add an ObjectId argument to `invoke_rpc_method` to make this work, but that's probably a good thing. Additionally, this commit tweaks the derive-deftly macro to prevent you from asking for dispatch bypass on special methods, where it isn't implemented (and doesn't really make sense).
* rpc: Add support for dropping the special "connection" object ID.Nick Mathewson2024-10-231-9/+19
|
* rpcserver: detect and use methods that bypass method dispatch.Nick Mathewson2024-10-231-3/+8
|
* rpc: List missing required features in error dataNick Mathewson2024-10-171-5/+7
| | | | | | | | | | Our spec says that when the RPC client has said "I require you to have feature X" and we don't have it, we need to include the feature(s) we don't have in an `rpc:unsupported_features` field of our error. Also, add an integration test for this behavior. Closes #1662
* Remove Rpc* variants from tor_error::ErrorKindNick Mathewson2024-10-171-4/+7
| | | | | | | | | | | | | These are not regular ErrorKinds, since they can never occur in an error that's meant to be returned from a Rust API like `arti-client`. Instead, they only exist for errors returned from RpcError. (I can't find the place where we discussed this previously, but the rationale is that if an ErrorKind never makes sense in response to something that the user does from Rust, we should never have that be an ErrorKind. The fact that the removed kinds do not actually appear outside the RPC system suggests that this is reasonable.)
* Use mpsc_channel_no_memquota in the RPC system (adding a TODO)Ian Jackson2024-10-151-2/+5
| | | | | We need to decide whether RPC will participate in memquota. Perhaps it should. But that's for the future.
* arti-rpcserver: minimal handling for request.meta.requireNick Mathewson2024-10-071-2/+25
| | | | | | | | | | We have defined a forward-compatibility mechanism for the RPC system, where a request may list one or more required "features", and if any feature is absent, the request will fail. Since no "features" are currently implemented, this code does the bare minimum to implement this mechanism, by rejecting every request with a nonempty "require" field.
* rpc: clarify documentation and fix typosNick Mathewson2024-10-021-1/+2
| | | | Based on review from @opara.
* Revise RPC documentation to be more informative.Nick Mathewson2024-10-021-0/+11
| | | | | | Previous documentation was more-or-less meant for the Arti developer only. This new documentation is intended for actual users of RPC functionality. It's meant to be extracted with `maint/rpc-doc-tool`.
* rpcserver: Split a few long lines.Nick Mathewson2024-09-161-5/+10
|
* rpcserver: move is_connection_close detection into run_loop.Nick Mathewson2024-09-161-6/+10
| | | | | | I've used an `async{ expr }.await` pattern, to make sure that _every_ error returned by the `loop{select!{}}` construct is actually transformed.
* rpcserver: Add an extra level of braces.Nick Mathewson2024-09-161-50/+52
| | | | (This will make the next commit easier to read.)
* rpcserver: Apply documentation suggestion.Nick Mathewson2024-09-161-0/+2
|
* rpcserver: Use a struct to enforce explicit ContinueNick Mathewson2024-09-161-2/+10
| | | | Per suggestion from @diziet.
* rpc: Simplify simplified close logic even furtherNick Mathewson2024-09-161-34/+37
| | | | | | Instead of classifying errors and complicating our behavior _early_ in our loop, instead we just decide whether an error indicates an EOF immediately before we return it.
* rpc: Simplify close logic even further.Nick Mathewson2024-09-161-6/+4
| | | | | | Make it more clear than the previous match statement that once we get an Err() from request_stream.next(), we aren't going to continue the loop.
* rpc: Simplify handling of fatal Json read errors.Nick Mathewson2024-09-161-32/+18
| | | | | | | | | | | | | | | | | | | | Previously, after determining that an error on an RPC connection was fatal, we would: 1. Determine whether it was a "clean" close or one that needed to be logged. 2. In exactly one case (specifically, when the inbound Json stream contained a Value that was not an Object) , we would send back a message to the client. 3. Exit the connection with Ok() or Err(e). We no longer do step "2" above. Additionally, we document: - Why it's important to exit immediately on syntax errors. - A better way to tolerate non-Object Json Values, if we decide someday to do so. Closes #1591.
* rpcserver: use more sophisticated handling for ConnectionError.Nick Mathewson2024-08-121-16/+66
| | | | | | | | | | | | In general, we don't want to return a ConnectionError for a simple EOF condition; we only want to report an error when there's an actual failure. Also, it's a good idea to capture the actual error return conditions that we get from aynchronous_codecs, rather than throwing them away as we did before. Closes #1517.
* Implement rpc::Context on Connection directlyNick Mathewson2024-06-101-25/+7
| | | | | | | | | | | This lets us get rid of a now-spurious `RequestContext` wrapper type and an extra layer of indirection; it will also make it easier to treat a Connection _as_ a context, so that we can have a context in the socks-rpc interface code. This patch removes a TODO about "treading carefully" when we make this change. When I added that TODO, I had misremembered some implementation details of the RPC object system.
* rpc: allow Connection::lookup_object to take &selfNick Mathewson2024-06-101-7/+16
| | | | This will allow us to implement rpc::Context on Connection directly.
* rpc: Make the connection type always-Arc.Nick Mathewson2024-06-101-3/+3
|
* Use refactored invoke_rpc_method in rpcserver.Nick Mathewson2024-06-101-6/+1
|