Nick Mathewson
6f6a4d073e
rpcbase: Use with_fn.
2023-04-19 12:38:26 -04:00
Nick Mathewson
8a8c800c99
async-utils: Add a SinkExt with a with_fn
...
(This function behaves as `futures::sink::SinkExt::with`, except
that the function that it takes does not return a future.)
2023-04-19 12:38:26 -04:00
Nick Mathewson
d54154e520
async-utils: rename sinkext to prepare_send
2023-04-19 12:38:26 -04:00
Nick Mathewson
5cd5e6a3f8
async-utils: rename SinkExt to SinkPrepareExt
2023-04-19 12:38:26 -04:00
Nick Mathewson
80a13ff898
rpc: Minor tweaks to get a sink to compile.
2023-04-19 12:38:26 -04:00
Nick Mathewson
0503f7bd4b
rpc: Use Method types to determine type of method outputs, updates.
...
This lets us do much less in our rpc_invoke_fn functions.
2023-04-19 12:38:26 -04:00
Nick Mathewson
7dcfb02c22
rpc: Split Method into DynMethod and Method
...
Now `Method` has an Output and Update associated type, and
`decl_method` can do a little more.
2023-04-19 12:38:26 -04:00
Alexander Færøy
1faa97c645
Merge branch 'post_1145' into 'main'
...
Followups from !1145
See merge request tpo/core/arti!1146
2023-04-18 16:03:48 +00:00
Ian Jackson
219153a541
Merge branch 'rpc_refactoring_v2' into 'main'
...
A few RPC refactorings
Closes #817 and #824
See merge request tpo/core/arti!1144
2023-04-18 16:00:05 +00:00
Ian Jackson
89fd20e8ca
Merge branch 'method_namespace' into 'main'
...
rpc spec: define method namespacing.
Closes #822
See merge request tpo/core/arti!1141
2023-04-18 15:53:58 +00:00
Ian Jackson
6c720962a8
Merge branch 'fix_802_core' into 'main'
...
DirMgr: Detect that directory state is ready if it begins with all MDs
Closes #802
See merge request tpo/core/arti!1126
2023-04-18 15:34:08 +00:00
Nick Mathewson
543e089b82
netdoc: Document that particular bit values for flags are not part of our API.
2023-04-17 17:09:58 -04:00
Nick Mathewson
11945e8b4e
netstatus: re-number routerstatus flags to go in order.
...
Otherwise there is too much risk of accidentally adding in another
1<<12 when we meant to add a 1<<13.
(It would be neat to have an alternative to bitflags here that would
auto-number our bitflags for us.)
2023-04-17 16:50:08 -04:00
Nick Mathewson
3985700216
netdir: more documentation on MIDDLE_ONLY flag.
...
Clarify that it isn't anything that most users will need to check.
2023-04-17 16:48:15 -04:00
Nick Mathewson
7d23daf0dd
Merge branch 'issue833_middleonly' into 'main'
...
netdoc: Add MiddleOnly flag to RelayFlags
Closes #833
See merge request tpo/core/arti!1145
2023-04-17 20:40:57 +00:00
juga
eee1dbee7a
netdoc: Add MiddleOnly flag to RelayFlags
...
Closes #833
2023-04-17 09:53:04 +00:00
Nick Mathewson
f5542d847f
Merge branch 'rustdoc-fix' into 'main'
...
rpcserver: Fix a couple of broken rustdoc links
See merge request tpo/core/arti!1143
2023-04-17 01:21:05 +00:00
Nick Mathewson
5a2c38a134
rpc: simplify API by always providing a sink.
...
Previously we have two places where we had to do "make a `Drain` sink
if updates aren't wanted"; now there's only one.
2023-04-16 08:46:42 -04:00
Nick Mathewson
83f5dc4888
rpc: Ensure well-ordering of responses.
...
Previously the main loop received updates via a `mpsc::channel`, and
final responses via a `futures::unordered`. This could lead to
final responses being transmitted to the user before the updates
were all flushed.
Now all of the responses are sent to the main loop via the same channel,
and they can't get out-of-sequence.
Closes #817 and (IMO) simplifies the code a bit.
2023-04-16 08:46:42 -04:00
Nick Mathewson
58ad91cbf5
rpc: Wire updates into rpc invoke functions again.
...
Now that the sink is not part of the context, RPC functions that are
able to send an update have to declare an `impl Sink` as their
fourth argument. This syntax is not final.
Part of #824 .
2023-04-16 08:46:42 -04:00
Nick Mathewson
3b9fc60763
rpc: Move update sink out of context.
...
Now the update sink is its own boxed object. It is not yet passed
to the invoke functions that want it.
2023-04-16 08:46:41 -04:00
Nick Mathewson
c51f44aa0b
rpcserver: Fix a couple of broken rustdoc links
2023-04-16 08:39:52 -04:00
Nick Mathewson
12a52e51a8
Merge branch 'fix-macos-repro' into 'main'
...
fix macos reproducible builds
Closes #832
See merge request tpo/core/arti!1142
2023-04-16 12:35:03 +00:00
trinity-1686a
1b348f5613
fix macos reproducible builds
2023-04-16 13:22:18 +02:00
Nick Mathewson
8bcf037c9d
Merge branch 'fix' into 'main'
...
Run cargo update
See merge request tpo/core/arti!1140
2023-04-13 15:13:33 +00:00
Nick Mathewson
e524f05aa9
rpc spec: define method namespacing.
...
Closes #822
2023-04-13 10:50:30 -04:00
Ian Jackson
6cdd7cc884
Run cargo update
...
The lockfile on main seems to be broken. I skim-eyeballed the diff,
which is entirely autogenerated.
2023-04-13 15:46:00 +01:00
gabi-250
31b6c9243d
Merge branch 'use_secmem_proc_03' into 'main'
...
Update our secmem_proc dependency to 0.3.0
Closes #664
See merge request tpo/core/arti!1138
2023-04-13 14:26:06 +00:00
gabi-250
da790e4b78
Merge branch 'misc_upgrades' into 'main'
...
Upgrade a couple more dependencies
See merge request tpo/core/arti!1139
2023-04-13 14:25:13 +00:00
Nick Mathewson
cf00fd8e8a
Merge branch 'rpc_conformance' into 'main'
...
RPC: Terminology and error-handling conformance
Closes #826 and #825
See merge request tpo/core/arti!1136
2023-04-13 13:45:40 +00:00
Nick Mathewson
8dd65dcd5f
rpc, spec: Document current ObjectError, RequestError behavior as correct.
2023-04-13 09:03:52 -04:00
Nick Mathewson
ea77f959fb
rpc: Change `id=<SYNTAX>` to "no id".
...
Now instead of hoping that buggy clients will detect a magic `id`,
we can simply tell them that they will get no `id` at all. If they
can't handle that case, no major harm is done: the connection will
get closed anyway.
2023-04-13 09:03:52 -04:00
Nick Mathewson
5041b51498
rpc: Require that errors are RpcError.
...
Since we're serializing everything in this format, let's enforce it.
With this change, we can no longer cram arbitrary junk into an
RPC error, so we have to clean up our handling of cancelled requests.
2023-04-13 09:03:52 -04:00
Ian Jackson
056f8a746e
Merge branch 'repro_msrv_update' into 'main'
...
Bump Rust version in reproducible build scripts
See merge request tpo/core/arti!1137
2023-04-13 11:59:39 +00:00
Nick Mathewson
4efb423947
Upgrade our hex-literal dependency
2023-04-13 07:51:26 -04:00
Nick Mathewson
50d95964d1
Upgrade our num_enum dependency.
2023-04-13 07:50:11 -04:00
Nick Mathewson
6e83139fc7
Update our secmem_proc dependency to 0.3.0
...
(This wasn't possible before we updated our MSRV to 1.65.)
Closes #664 .
2023-04-13 07:41:46 -04:00
Nick Mathewson
a9b1d8f612
Bump Rust version in reproducible build scripts
...
Now that we require 1.65, Rust 1.63 is no longer sufficient.
2023-04-13 07:31:20 -04:00
Nick Mathewson
99c64abb6a
Merge branch 'devdoc' into 'main'
...
Document some properties of semver
See merge request tpo/core/arti!1129
2023-04-12 20:37:25 +00:00
Nick Mathewson
767c91557e
rpc: Improve error reporting for invalid requests
...
This is a bit big, but it's not that _complicated_.
The idea here is that we use serde's "untagged" enum facility
when parsing our `Request`s, such that if parsing as a `Request`
fails, we parse as an `InvalidRequest` and try to report
what the problem was exactly.
This lets us determine the ID of a request (if it had one),
so we can report that ID in our error message. We can also
recover from a much broader variety of errors.
We now also conform with the spec reporting errors about
completely wrong json, requests without IDs, and so on.
2023-04-12 16:21:34 -04:00
Nick Mathewson
89568ead54
rpc spec: Allocate a special ID for syntax errors.
2023-04-12 15:17:15 -04:00
Nick Mathewson
739561b2cb
rpcbase: Use correct error codes, and add tests.
...
Well, mostly correct. Our current serde implementation doesn't
tell us much about what went wrong with the object, so we can't
tell why we couldn't convert it into a Request.
Also, our output for the data field is not as the spec says:
we should bring them into conformance.
Part of #825 .
2023-04-12 13:32:15 -04:00
Nick Mathewson
e37b017342
tor-error: Add ErrorKinds for RPC errors.
...
These are experimental for now so that we can change them without
breaking semver.
2023-04-12 13:30:24 -04:00
Ian Jackson
1d0fae5467
dev docs: Reference semver trick
...
Discussion
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1129#note_2895839
2023-04-12 18:06:30 +01:00
Ian Jackson
5ae7e3c3f8
dev docs: Adding missing footnote
...
Discussion
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1129#note_2895837
2023-04-12 18:06:30 +01:00
Ian Jackson
09c7efe4a4
dev docs: Avoid main-verb-less sentence
...
Discussion
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1129#note_2895835
2023-04-12 18:06:30 +01:00
Ian Jackson
25b89af11c
dev docs: Add missing word
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1129#note_2895834
2023-04-12 18:06:30 +01:00
Nick Mathewson
81368f2b5b
dev docs: Clarify that it's two instances of the crate
2023-04-12 17:04:59 +00:00
Nick Mathewson
72277b902e
dev docs: Clarify wording re who is exporting what
2023-04-12 17:03:46 +00:00
Ian Jackson
1d2514a06e
Merge branch 'ticket_785' into 'main'
...
ExitPath: Add an explanation of WeightRole::Exit on non-exit circs
Closes #785
See merge request tpo/core/arti!1135
2023-04-12 17:00:36 +00:00