aboutsummaryrefslogtreecommitdiff
path: root/tor-dirclient/src
Commit message (Collapse)AuthorAgeFilesLines
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-275-1368/+0
| | | | | This will cause some pain for now, but now is really the best time to do this kind of thing.
* WIP: Add the "unwrap_used" lint.S0AndS02021-08-241-0/+1
| | | | | | | | | | | | | | | | | > Check `unwrap_used` section of Clippy documentation for details; > > https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used This adds the following Clippy configuration to crates; #![deny(clippy::unwrap_used)] **Warning** while tests and compiler do not show any errors, the submitted changes are very much a Work In Progress and mistakes may have been made. Check https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/67 Merge Request thread for more details.
* Switch all uses of the log crate to the tracing.Jani Monoses2021-08-201-1/+1
| | | | Issue #74
* Merge remote-tracking branch 'origin/mr/60'Nick Mathewson2021-08-181-0/+1
|\
| * Add the "missing_panics_doc" lint.S0AndS02021-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | > Check `missing_panics_doc` section of Clippy documentation for details; > > https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc This adds the following Clippy configuration to crates; #![deny(clippy::missing_panics_doc)] And adds necessary doc-comments to methods that may panic.
* | Add the "implicit_clone" lint.S0AndS02021-08-171-0/+1
|/ | | | | | | | | | | | | | > Check `implicit_clone` section of Clippy documentation for details; > > https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone This adds, and addresses, the following Clippy configuration to crates; #![deny(clippy::implicit_clone)] And moves related line within `maint/add_warning.py` file. My intent is to mitigate extra edits after merging, so please let me know if I need to do this last bit differently.
* Use add_warnings.py for clippy::cast_losslessNick Mathewson2021-08-131-1/+1
|
* Add the "cast_lossless" lint.S0AndS02021-08-121-0/+1
| | | | | | | | | | | | > Check `cast_lossless` section of Clippy documentation for details; > > https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless This adds the following Clippy configuration to crates; #![deny(clippy::cast_lossless)] And applies suggested Clippy and `cargo fmt` fixes.
* Merge commit 'origin/mr/46^'Nick Mathewson2021-08-122-8/+6
|\
| * Change output type in DirResponse to Vec<u8>rls2021-07-302-8/+6
| | | | | | | | | | | | | | | | | | | | Previously the DirResponse contained a String for the output. By changing it to a Vec<u8> the caller has to parse the Vec<u8> and deal with potential failures. With this change `fetch_multiple`'s `useful_responses` should also contain non-UTF-8 responses. This will case an Err to be returned in the `download_attempt` function if the DirResponse does not contain valid UTF-8.
* | Merge remote-tracking branch 'origin/mr/51'Nick Mathewson2021-08-091-7/+21
|\ \
| * | shrink result to actual number of bytes read once on returnFelipe Lema2021-08-051-6/+8
| | |
| * | fix clippy::redundant_slicingFelipe Lema2021-08-051-1/+1
| | |
| * | use loop + `read` + slice-of-resultFelipe Lema2021-08-051-20/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Loop into several reads because we want to short-circuit if case we're reading too many bytes. Added handling of allocation of `result` so we can use the "next window buffer" for `read`. This way we can read on steps and short-circuit when needed.
| * | read from stream in a single go (not looping)Felipe Lema2021-08-031-27/+21
| | |
| * | don't use intermediate buffer, but read directly into `result`Felipe Lema2021-08-031-3/+1
| |/
* | Add unnecessary_wraps to the big warning list.Nick Mathewson2021-08-061-0/+1
| |
* | Fix typos and other spelling mistakesrls2021-07-312-2/+2
|/
* Add clippy warn needless pass by valueYUAN LYU2021-06-213-14/+15
|
* Add clippy warn needless borrowYUAN LYU2021-06-211-0/+1
|
* Fix some warnings about needless & from nightly clippyNick Mathewson2021-06-181-1/+1
|
* Enormous tor-circmgr rewrite.Nick Mathewson2021-06-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with the tor-chanmgr code, the circuit manager is now implemented using an AbstractCircMgr type that uses traits to abstract the particular behavior of other types that it uses. (Specifically: circuits, building circuits, and telling whether one circuit usage is compatible with another.) Abstracting out the dependencies in this ways makes it possible to test the circuit manager without having to actually build real circuits. This commit also introduces new behavior for handling pending circuit requests. Upon getting a new request, first we check to see if there's an existing circuit we can use. If there isn't, we look for pending circuits and wait for them. If there aren't any pending circuits we can use, we launch one or more, and wait for them. So far, that's the same as the old behavior. But here's a change: if, while we are waiting for some pending circuits, a different circuit is completed, and it's one we could use, then the task that was building _that_ circuit will tell us: "please look at this circuit". This gives us better changes of getting a usable circuit fast. Minor changes: * The Error type in CircMgr no longer uses anyhow; several errors have been simplified. * We've gotten more formal about the relationship between circuit usage and target usage.
* Add noop_method_call warning.Nick Mathewson2021-05-271-0/+1
| | | | | | This would have saved ahf and me a lot of confusion in debugging a situation where we were cloning a reference of a type that didn't implement Clone.
* Enable cargo_common_metadata warning.Nick Mathewson2021-05-251-0/+1
|
* Module docs for remaining cratesNick Mathewson2021-05-251-5/+13
|
* Add the "unreachable_pub" lint.Nick Mathewson2021-05-181-0/+1
| | | | | | This is a somewhat obnoxious change in its scope and requirements, but it makes it easier to understand what the real public and private parts of our APIs are.
* Prefer "relay" to "server" when appropriate.Nick Mathewson2021-05-181-1/+1
|
* Resolve clippy warnings from Rust 1.52.Nick Mathewson2021-05-071-1/+1
| | | | | | | | | | Rust 1.52 just came out, and there are new clippy lints to deal with: * It spots more cases when we could use Option::map * It spots more cases when we could use Iterator::flatten * When we build a struct instance, it wants us to list the fields in the same order that the struct declares them.
* Add trait_duplication_in_bounds warning.Nick Mathewson2021-05-031-0/+1
|
* Add unseparated_literal_suffix lint, and fix it.Nick Mathewson2021-05-031-0/+1
|
* Add a few more clippy warningsNick Mathewson2021-05-031-0/+5
|
* Split mocking parts of rtcompat into new rtmock crate.Nick Mathewson2021-05-031-2/+1
| | | | | Since these parts are testing-only, let's take steps to make sure we don't ship them in production by accident.
* Add some more clippy warnings to our list.Nick Mathewson2021-04-271-1/+6
|
* Enforce (and obey) clippy lints about exhaustive enums, structs.Nick Mathewson2021-04-272-0/+4
| | | | | | | | These lints force us to declare our exported enums and exhaustive-looking structs as non-exhaustive (so that we can add to them in the future without breaking our API) or to explicitly disable the warning for a given enum/struct (to say that we _intend_ for additions to be a breaking change).
* Only list the supported encodings in the `Accept-Encoding` headerNick Mathewson2021-04-211-10/+27
| | | | Closes #113
* Use stream_pair() to write a test for tor_dirclient::downloadNick Mathewson2021-04-211-0/+50
|
* Make zstd and xz compression optional, but on-by-default.Nick Mathewson2021-04-211-1/+11
|
* Test for tor_dirclient::read_headersNick Mathewson2021-04-201-0/+39
|
* Tests for tor_dirclient::read_and_decompressNick Mathewson2021-04-201-3/+86
|
* Test for tor_dirclient::read_until_limited()Nick Mathewson2021-04-201-0/+35
|
* tor-dirclient: more requests.rs testsNick Mathewson2021-04-201-10/+69
|
* Move timer functions into an extension trait.Nick Mathewson2021-04-172-5/+5
|
* Move around the public modules in tor_rtcompat.Nick Mathewson2021-04-171-1/+1
|
* Remove all non-runtime methods in tor_rtcompat.Nick Mathewson2021-04-161-9/+19
|
* Add a "Runtime" parameter to all the manager types.Nick Mathewson2021-04-161-3/+6
| | | | | This is a big change, but it is a step towards our goal of removing tor_rtcompat:: calls directly.
* Replace tor-decompress with async-compression crate.Nick Mathewson2021-04-132-63/+48
| | | | This lets us simplify tor-dirclient a fair bit. Closes #79.
* tor-dirclient: Use AsyncBufRead to simplify code a bit.Nick Mathewson2021-04-131-29/+62
| | | | | | | | | | | Previously we read too much data from our input, and then used the unused portion as an initial state of a buffer for handling subsequent data. Yuck! Instead we can just use an AsyncBufRead and only read the parts we want. This code takes some pains to never read too much data: I'd rather just "read until the first CRLF" or have some kind of pushback mechanism. But for now it's probably fine.
* Major revision on DirMgr logic -- almost a complete rewrite.Nick Mathewson2021-04-131-2/+2
| | | | | | | | The big idea of this revision is to separate the code that knows about doing downloads from the code that decides what to download. Later, we can make a similar change for database access. With these changes together, we can make our code much more testable, and eventually enable more download types in parallel.
* Start moving responsibility for building requests into dirmgrNick Mathewson2021-04-091-0/+31
| | | | This will help with my planned "directory state" refactoring.
* Make ConsensusRequest take a flavor.Nick Mathewson2021-04-011-9/+13
|