summaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/traits.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix typosDimitris Apostolou2022-12-091-1/+1
|
* tor-rtcompat: Require that TcpStream be SendIan Jackson2022-08-151-1/+1
| | | | The lack of this seems to have been an oversight.
* rt-compat: Make all the individual runtime traits Clone+Send etc.Ian Jackson2022-06-081-5/+5
| | | | | | | | This will make it much more convenient for code that only wants one of these traits (or a subset of them). This is a good thing to support because it will allow us to use a ZST in places that do not need an actual async runtime handle (typically, the runtime handle is needed only for spawn).
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-0/+3
| | | | | | | | | | | | | | - arti#445 highlighted the lack of good documentation around Arti's multiple runtime support, as well as it being difficult to determine what runtime was actually in use. - Improve the documentation to solve the first problem. - To solve the second problem, make Runtime require Debug (which is arguably a good idea anyway, since it makes them easier to embed in things), and print out the current runtime's Debug information when arti is invoked with `--version`. - (It also prints out other Cargo features, too!) fixes arti#445
* Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-1/+0
|
* Merge branch 'no-system-time' into 'main'eta2022-03-301-0/+1
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-251-0/+1
| |
* | UdpSocket: remove support for connect().Nick Mathewson2022-03-181-7/+4
| | | | | | | | | | | | | | | | Currently, Arti doesn't need this. But once it does, it will be way better to have a separate type for connected sockets, rather than having to error-check every time somebody gives us a socket. Part of #410
* | add simple unit test on UDPtrinity-1686a2022-03-141-0/+2
| |
* | fix typos and minor issuestrinity-1686a2022-03-141-1/+1
| |
* | add skeleton for DNS handlingtrinity-1686a2022-03-141-2/+5
| |
* | add udp to runtimetrinity-1686a2022-03-141-0/+27
|/
* Fix rustdoc "skip this" markupIan Jackson2022-02-241-1/+1
|
* tor-rtcompat: Provide TLS wrapping for all streamsIan Jackson2022-02-241-0/+18
| | | | | | | | Now all of the runtime types we provide all impl<S> TlsProvider<S> where S: ... rather than merely TlsProvider<Self::TcpStream>. And we document and intent to perhaps require this in the future.
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-4/+4
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* More comments on the limitations of tor-rtcompat's TLS APINick Mathewson2022-01-251-3/+26
| | | | | Also, more comments on why these limitations are safe within the context of Tor, but you wouldn't want to use them elsewhere.
* Comment-only: document sni_hostname more.Nick Mathewson2022-01-251-3/+5
| | | | | Previously we expected the reader to automatically know why it was called "SNI", which really isn't fair.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-14/+19
| | | | | | | | | | | | | | | | | | | | `tor-rtcompat`'s `TlsConnector` trait previously included a method to create a TLS-over-TCP connection, which implied creating a TCP stream inside that method. This commit changes that, and makes the function wrap a TCP stream, as returned from the runtime's `TcpProvider` trait implementation, instead. This means you can actually override `TcpProvider` and have it apply to *all* connections Arti makes, which is useful for issues like arti#235 and other cases where you want to have a custom TCP stream implementation. This required updating the mock TCP/TLS types in `tor-rtmock` slightly; due to the change in API, we now store whether a `LocalStream` should actually be a TLS stream inside the stream itself, and check this property on reads/writes in order to detect misuse. The fake TLS wrapper checks this property and removes it in order to "wrap" the stream, making reads and writes work again.
* Improve some documentation linksNick Mathewson2021-10-291-2/+3
| | | | | | | | | Instead of putting a fully qualified name in the text, in most cases we should just use the short name of the type or function we're referring to. In other words, instead of saying [`crate::module::Foo`], we should typically say [`Foo`](crate::module::Foo).
* Clarify that new SleepProvider methods are testing-only.Nick Mathewson2021-10-261-0/+9
|
* Overhaul the way WaitFor and the MockSleepProvider worketa2021-10-261-0/+16
| | | | | | | | | | | | | | | | | | | | | Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor). The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required. (In some cases, code needed to be hacked up a bit in order to be made properly testable using these APIs; the `MockablePlan` trait included in here is somewhat unfortunate.) This should fix arti#149.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+176
This will cause some pain for now, but now is really the best time to do this kind of thing.