summaryrefslogtreecommitdiff
path: root/crates/tor-basic-utils/src/futures.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-basic-utils: DropNotifyWatchSender: use DropNotifyEofSignallableIan Jackson2022-11-231-7/+37
| | | | | This will help avoid the programmer making the mistake I made here: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/852#note_2854029
* tor-basic-utils: DropNotifyWatchSender test: introduce IIan Jackson2022-11-231-6/+9
| | | | | We do want to test this with a non-Option type, but we are going to have to wrap it up.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* tor-basic-utils: Add a test for DropNotifyWatchSenderIan Jackson2022-07-191-0/+17
|
* tor-basic-utils: Add ref to upstream issue re dropIan Jackson2022-07-191-0/+3
|
* tor-basic-utils: Add comment about lack of raceIan Jackson2022-07-191-0/+4
| | | | | | | In answer to https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/632#note_2822107 I think this is subtle enough that it deserves a comment.
* arti-client: Provide DropNotifyWatchSenderIan Jackson2022-07-181-0/+41
| | | | | | | | | | | | There are going to be some tasks (well, right away, one task) which will want to go away when the sender is dropped. The docs in postage are silent, but postage::watch::Sender does not have a Drop impl so I don't think we can rely on the Receivers getting None from their Stream impl. So we're going to have the watch send Options, which are None only when the sender is dropped.
* Provide maybe_send on postage::watch::Sender, via extension traitIan Jackson2022-07-181-0/+87
| | | | | | | | | | | | We need to replace the AtomicBool for dormant mode with something that can wake up tasks. postage::watch is the right shape. But we want to be able to update it but suppress no-op updates. (There is going to be a call site where no-op updates can occur.) In the absence of a suitable upstream method as requested here https://github.com/austinjones/postage-rs/issues/56 we introduce this facility via an extension trait.
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-2/+9
| | | | | | Found these by disabling the nightly dbg macro special case. Now, we have a mechanism for globally adding suppressions to tests, we can use that instead.
* Typo fixes (automated with "typos").Nick Mathewson2022-05-241-4/+4
|
* Suppress clippy warnings in tor-basic-utils.Nick Mathewson2022-05-231-0/+1
| | | | These are warnings that we've decided it's okay to suppress elsewhere.
* prepare_send_from: clippy: Have dprintln explicitly return ()Ian Jackson2022-05-231-1/+1
|
* prepare_send_from: clippy: Avoid a lintIan Jackson2022-05-231-2/+1
| | | | I think this is worse code, but it's not *significantly* worse.
* prepare_send_from: clippy: Add missing docsIan Jackson2022-05-231-11/+18
| | | | I intend to reintroduce this in its own MR.
* prepare_send_from: clippy: Replace two unwrapsIan Jackson2022-05-231-2/+6
|
* prepare_send_from: Break out get_output! macroIan Jackson2022-05-231-2/+11
| | | | So we can change unwrap to expect, which makes this too long to repeat.
* prepare_send_from: docs and comments improvementsIan Jackson2022-05-231-13/+115
| | | | Apropos review.
* prepare_send_from: Add testsIan Jackson2022-05-231-0/+122
| | | | | | When I added these tests, they didn't find any bugs in my own implementation, but I did find a bug in futures::future::unfold. See the in-code comment.
* channel: Provide and use Sink::prepare_send_fromIan Jackson2022-05-231-0/+292
This is a general-purpose implementation of the ad-hoc approach currently taken in (eg) crates/tor-proto/src/channel/reactor.rs, with an API intended to defned against the more obvious mistakes. This allows us to separate the two concerns: the channel reactor can focus on handling channel cells and control messages and is over 2.5x shorter. The complexity of the manual sink implementation, and the machinery needed to avoid having to suspend while holding an item, are dealt with separately. That separate implemenation now has proper documentation. (Tests are in the nest commit to avoid this one being even more unwieldy.) We use `extend` to define this as an extension trait. A competitor is `ext` but in my personal projects I have found `extend` slightly better.