Commit Graph

49 Commits

Author SHA1 Message Date
Nick Mathewson 3fc66306c5 Tests for sleep_until_wallclock. 2021-04-20 09:34:34 -04:00
Nick Mathewson 4a761f55ea A little more testing for tor_rtcompat::mock::time. 2021-04-20 08:26:41 -04:00
Nick Mathewson a910627e92 Add support for simulating the passage of time. 2021-04-19 20:13:12 -04:00
Nick Mathewson 5f850fad1f Add "now" functions to SleepProvider. 2021-04-19 20:03:27 -04:00
Nick Mathewson ec6dc417b9 rtcompat: remove an unused conversion function. 2021-04-19 10:28:41 -04:00
Nick Mathewson fe22c329c6 Simple unit tests for tor_rtcompat: at last! 2021-04-19 10:24:13 -04:00
Nick Mathewson a271faca3a rtcompat: mark some outputs as must-use. 2021-04-19 10:08:18 -04:00
Nick Mathewson b8e1234a4c Clarify what TlsConnector doesn't validate. 2021-04-19 08:24:22 -04:00
Nick Mathewson 50f5ad9850 Flatten async_std impl module slightly. 2021-04-19 08:20:20 -04:00
Nick Mathewson e3c51519e8 Flatten tokio TcpProvider implementation a bit. 2021-04-19 08:15:12 -04:00
Nick Mathewson 065162aff2 Add a local_addr() function for TcpListener. 2021-04-18 18:02:30 -04:00
Nick Mathewson 975374beb5 Fix some broken rustdoc links. 2021-04-18 17:55:43 -04:00
Nick Mathewson 342a98dccd tor_rtcompat: Documentation and cleanups 2021-04-17 17:09:20 -04:00
Nick Mathewson a774cdde80 Remove the no-longer-needed "global runtime" code. 2021-04-17 17:09:20 -04:00
Nick Mathewson ee556eb714 Remove some cruft in tor_rtcompat::impls 2021-04-17 17:09:20 -04:00
Nick Mathewson 745a7a89f5 Remove need for async_trait in SleepProviderExt 2021-04-17 17:09:20 -04:00
Nick Mathewson 92de7c58f0 Move timer functions into an extension trait. 2021-04-17 09:37:46 -04:00
Nick Mathewson 6878fe8336 Move around the public modules in tor_rtcompat. 2021-04-17 09:21:09 -04:00
Nick Mathewson 1d07132787 Remove all non-runtime methods in tor_rtcompat. 2021-04-16 17:15:55 -04:00
Nick Mathewson 8532cef9aa Add a "Runtime" parameter to all the manager types.
This is a big change, but it is a step towards our goal of removing
tor_rtcompat:: calls directly.
2021-04-16 16:12:08 -04:00
Nick Mathewson ebcfd38b48 rtcompat: Make TLS functionality use Runtime traits.
Now there is nothing in principle that you couldn't access from a
Runtime implementation.
2021-04-16 15:44:36 -04:00
Nick Mathewson e0f4c222dd Move the "sleep()" function from task to timer. 2021-04-16 15:44:36 -04:00
Nick Mathewson 6821211e1e Make incoming Streams of TcpStream a real type for each backend.
This makes things a little more complicated for AsyncStd, and a
little simpler for Tokio.
2021-04-16 15:44:20 -04:00
Nick Mathewson 5a587a55b4 Port tor_rtcompat::net to use Runtime objects. 2021-04-16 15:44:20 -04:00
Nick Mathewson 459a884f94 Port tor_rtcompat::timer to use Runtime objects. 2021-04-16 13:20:56 -04:00
Nick Mathewson f3505cad49 Begin a refactoring of tor-rtcompat to use runtime objects.
So far, all traits are defined (I hope) and the task api is ported.

With time I want to have none of the current "global runtime" APIs
exposed, and just use Runtime objects instead.  But that isn't just
yet.
2021-04-16 11:25:50 -04:00
Nick Mathewson d18013c03a rtcompat: rename traits module to impl_traits. 2021-04-16 09:47:15 -04:00
Nick Mathewson 1da7fccfc0 rtcompat: Add a cancellable-task-handle type.
The API is a bit yucky, since it has to be compatible with tokio and
async_std.

(Also, this patch fixes some async_std clippy warnings)
2021-04-09 08:01:38 -04:00
Nick Mathewson d073f24138 Move responsibility for knowing about TLS into tor_rtcompat.
Now we don't need runtime-specific stuff in tor-chanmgr.
2021-03-23 15:59:39 -04:00
Nick Mathewson 68f18d4fe3 Refactor tokio implpementation in tor-rtcompat.
Now other crates don't need any 'ifdef tokio' code, since there
are wrappers that implement 'futures' right.

Technically, the 'futures' traits are in some ways less good than
the tokio ones, but we need a consistent API if we want to support
WASM someday and keep support for async_std.  I'd rather hold out
hope for a future version of futures::io working like tokio than to
fix ourselves into the tokioverse forever.
2021-03-23 11:00:09 -04:00
Nick Mathewson a4e0dde4da Add appropriate categories to some Cargo.toml files. 2021-03-17 14:51:18 -04:00
Nick Mathewson 6daf57957d Add the tor project as an author. 2021-03-17 14:43:40 -04:00
Nick Mathewson ba14d43be4 Add keywords to each Cargo.toml 2021-03-17 14:41:02 -04:00
Nick Mathewson c8481a9354 Add a description field to all our Cargo.toml files 2021-03-17 14:31:59 -04:00
Nick Mathewson 58d8472ea0 Give it a homepage everyplace. 2021-03-17 14:13:26 -04:00
Nick Mathewson 7dd92e3808 Cut down on tokio features. 2021-03-10 15:42:26 -05:00
Nick Mathewson 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -05:00
Nick Mathewson 572e2b93de Update docs wrt tokio a bit 2021-03-02 12:12:41 -05:00
Nick Mathewson 8c31418500 Port to work with tokio or async-std.
This is fairly ugly and I think I'll need to mess around with the
feature configuration a while until we get something that's pleasant
to develop with.  This still seems like a good idea, though, since
we _will_ need to be executor-agnostic in the end, or we'll have no
way to handle wasm or embedded environments.

Later down the road, we'll probably want to use futures::Executor or
futures::Spawn more than having global entry points in
tor_rtcompat.  That would probably make our feature story simpler.

Tokio is the default now, since tokio seems to be more heavily used
for performance-critical stuff.

This patch breaks tests; the next one will fix them, albeit
questionably.
2021-03-02 11:55:09 -05:00
Nick Mathewson 635cdc06d8 Write a few misc unit tests 2020-12-15 15:34:08 -05:00
Nick Mathewson 4ac4f5496e rtcompat: add a function to sleep until a given wallclock time
(We can't just subtract and sleep, since we should be at least
somewhat concerned about clock jumps.)
2020-12-04 13:12:45 -05:00
Nick Mathewson 40ac33bde2 Upgrade async-io 2020-12-03 13:05:51 -05:00
Nick Mathewson 0dc5c7b459 Bump to latest async-io 2020-12-01 15:21:50 -05:00
Nick Mathewson f5f2a648a3 tor-dirclient: add timeouts
This adds two timeouts in total: one for sending begin, and getting
headers, and one for getting the rest of the data.

These timeouts are way too long right now, but at least the code is
there.
2020-12-01 08:56:25 -05:00
Nick Mathewson 3d4f5f261e Require documentation in tor-rtcompat. 2020-11-20 17:24:16 -05:00
Nick Mathewson 5b2e18e358 tor-chanmgr: timeout support. 2020-11-11 17:34:54 -05:00
Nick Mathewson 6ae2713763 Document tor-rtcompat crate a little 2020-11-11 14:40:01 -05:00
Nick Mathewson 9504086793 Remove a couple of unused dependencies 2020-11-11 13:48:38 -05:00
Nick Mathewson 59e4b5631a Isolate async_std usage in a new tor_rtcompat crate.
Like tor_llcrypto, this crate is meant to expose only the part of
other crates (in this case, a async runtime crate) that we use.
2020-11-11 13:46:39 -05:00