summaryrefslogtreecommitdiff
path: root/crates/tor-basic-utils
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate versions in preparation for Arti 1.0.0 release.Nick Mathewson2022-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because we want to work more on ensuring that our semver stability story is solid, we are _not_ bumping arti-client to 1.0.0 right now. Here are the bumps we _are_ doing. Crates with "minor" bumps have had API breaks; crates with "patch" bumps have had new APIs added. Note that `tor-congestion` is not bumped here: it's a new crate, and hasn't been published before. ``` tor-basic-utils minor fs-mistrust minor tor-config minor tor-rtcompat minor tor-rtmock minor tor-llcrypto patch tor-bytes patch tor-linkspec minor tor-cell minor tor-proto minor tor-netdoc patch tor-netdir minor tor-persist patch tor-chanmgr minor tor-guardmgr minor tor-circmgr minor tor-dirmgr minor arti-client minor arti-hyper minor arti major arti-bench minor arti-testing minor ```
* tor-basic-utils: Provide IoErrorExt is_not_a_directory()Ian Jackson2022-08-253-0/+31
| | | | | We're going to want this functionality, which isn't in the stable stdlib.
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-242-0/+4
|
* Bump patch versions on crates that have new APIs.Nick Mathewson2022-08-011-1/+1
| | | | | | | | | | | | | | Do _not_ bump the dependency versions on crates that have had no changes since arti 0.0.5, since those crates do not depend on the new APIs. ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p tor-llcrypto --bump patch git restore crates/tor-checkable git restore crates/tor-consdiff git restore crates/tor-rtmock ```
* 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-182-0/+89
| | | | | | | | | | | | 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.
* Merge branch 'cirmgr_error_cleanup' into 'main'Ian Jackson2022-07-151-0/+44
|\ | | | | | | | | Clean-ups in circmgr errors See merge request tpo/core/arti!625
| * tor-basic-utils: Add a new interface to FilterCountNick Mathewson2022-07-121-0/+44
| | | | | | | | | | | | | | | | This interface allows using FilterCount with functions that expect predicates rather than iterator chains. I'm about to use it to get meaningful FilterCount results in the path-selection code in circmgr.
* | Fix two rustdoc linksIan Jackson2022-07-121-2/+2
|/ | | | This type must have been renamed, I guess.
* Add a semver note to FilterCountNick Mathewson2022-07-081-1/+6
|
* FilterCount: Add a simple Display helper.Nick Mathewson2022-07-061-0/+34
| | | | | | This is a helper rather than a Display implementation because it isn't the only logical way to display these values. (In fact, without context, it isn't even the _most_ logical way)
* New "counting filter" iterator helper in tor-basic-utils.Nick Mathewson2022-07-062-0/+116
| | | | | | | This is going to make it simpler to write the code in guardmgr (and later in circmgr) that keeps track of how many relays were rejected for what reason. The latter, in turn, should improve error messages when we're unable to pick a guard or a path.
* Bump crate and dependency versions.Nick Mathewson2022-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were done with the following commands: ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-error --bump patch cargo set-version -p tor-config --bump patch cargo set-version -p tor-units --bump patch cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-llcrypto --bump patch cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump patch cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump patch cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump patch cargo set-version -p tor-dirclient --bump patch cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump patch cargo set-version -p arti --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor ```
* 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.
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* Fix a rustdoc link.Nick Mathewson2022-06-071-1/+1
|
* Merge branch 'use-testing-rng'Nick Mathewson2022-06-071-1/+2
|\
| * Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | | | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* | Merge branch 'testing-rng' into 'main'Nick Mathewson2022-06-023-0/+341
|\| | | | | | | | | New facility for deterministic and reproducible test PRNGs. See merge request tpo/core/arti!561
| * New facility for deterministic and reproducible test PRNGs.Nick Mathewson2022-06-023-0/+341
| | | | | | | | | | | | | | | | | | | | | | The new `testing_rng()` function is meant as a replacement for thread_rng() for use in unit tests. By default, it uses a randomly seeded RNG, but prints the seed before the test so that you can reproduce any failures that occur. You can override this via the environment to use a previous seed, or by using a deterministic seed for all your tests. Backend for #486.
* | lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-1/+1
| | | | | | | | | | From running add_warning, with manual picking of the right hunks/lines.
* | lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
|/ | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* Lexically sort Cargo.toml dependenciesOrhun Parmaksız2022-05-281-1/+1
| | | | | | Utilize cargo-sort: https://github.com/DevinR528/cargo-sort Signed-off-by: Orhun Parmaksız <[email protected]>
* Semantic version changes for Arti 0.4.0 releaseNick Mathewson2022-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | I followed the following procedure to make these changes: * I used maint/changed_crates to find out which crates had changed since 0.3.0. * I used grep and maint/list_crates to sort those crates in topological (dependency) order. * I looked through semver_status to find which crates were listed as having semver-relevant changes (new APIs and breaking changes). * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no changes. For those crates, I incremented their patch-level version _without_ changing the version that other crates depend on. * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no obvious breaking changes. * I treated all crates that depend on `arti` and/or `arti-client` as having breaking changes. * I identified crates that depend on crates that have changed, even if they have not changed themselves, and identified them as having a non-breaking change. * For all of the crates, I used `cargo set-version -p $CRATE --bump $STATUS` (where `STATUS` is `patch` or `minor`) to update the versions, and the depended-upon versions.
* Typo fixes (automated with "typos").Nick Mathewson2022-05-241-4/+4
|
* Suppress clippy warnings in tor-basic-utils.Nick Mathewson2022-05-232-0/+2
| | | | 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-233-0/+297
| | | | | | | | | | | | | | | | | | | | 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.
* Bump the version of every* crate to 0.3.0Nick Mathewson2022-05-061-1/+1
| | | | * Except for safelog and fs-mistrust, which are new.
* Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-261-0/+30
|\ | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * Rename macro_first_nonempty (from macro_coalesce_args)Ian Jackson2022-04-251-2/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798026
| * macro_coalesce_args: New helper macroIan Jackson2022-04-251-0/+30
| |
* | Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | This is an automated change made with a perl one-liner and verified with grep -L and grep -l. Some warnings are introduced with this change; they will be removed in subsequent commits. See arti#208 for older discussion on this issue.
* | Add 'rust-version = "1.56"' to every Cargo.toml file.Nick Mathewson2022-04-251-0/+1
|/ | | | | | | This change was made automatically with a perl one-liner, and confirmed with `grep -L`. The `rust-version` field itself was introduced in 1.56.0.
* tor-basic-utils: Add RetryDelay::reset testSamanta Navarro2022-04-231-0/+2
|
* Add RetrySchedule::reset()Nick Mathewson2022-04-041-0/+5
| | | | | | | | | | | Previously the code would do stuff like ``` schedule = RetrySchedule::new(INITIAL_DELAY); ``` which is needlessly verbose, since the schedule already keeps track of its initial delay.
* Bump all arti*, tor* crates to 0.2.0Nick Mathewson2022-04-011-1/+1
| | | | | | | | Not all of these strictly need to be bumped to 0.2.0; many could go to 0.1.1 instead. But since everything at the tor-rtcompat and higher layers has had breaking API changes, it seems not so useful to distinguish. (It seems unlikely that anybody at this stage is depending on e.g. tor-protover but not arti-client.)
* Update README.md files using readmes scriptNick Mathewson2022-03-291-0/+4
|
* Adjust a commentIan Jackson2022-03-211-1/+1
| | | | Noticed this while reviewing !426
* Provide define_accessor_trait and use it to generate CircMgrConfigIan Jackson2022-03-162-0/+69
|
* RetryDelay: remove accessors.Nick Mathewson2022-03-161-17/+1
| | | | Instead, check initial_delay in dirmgr directly.