summaryrefslogtreecommitdiff
path: root/src/rust/protover/lib.rs
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2018-03-21 01:29:36 +0000
committerIsis Lovecruft <isis@torproject.org>2018-04-02 19:20:27 +0000
commitb786b146edd33b025774819f54d7bba3d07bf832 (patch)
tree4e93c8d9eeee5525409e6d427aae5a2d9f8a5409 /src/rust/protover/lib.rs
parent88b2f170e451567a3b0095a420544a675a5826b0 (diff)
downloadtor-b786b146edd33b025774819f54d7bba3d07bf832.tar.gz
tor-b786b146edd33b025774819f54d7bba3d07bf832.zip
rust: Add new protover::UnvalidatedProtoEntry type.
This adds a new protover::UnvalidatedProtoEntry type, which is the UnknownProtocol variant of a ProtoEntry, and refactors several functions which should operate on this type into methods. This also fixes what was previously another difference to the C implementation: if you asked the C version of protovet_compute_vote() to compute a single vote containing "Fribble=", it would return NULL. However, the Rust version would return "Fribble=" since it didn't check if the versions were empty before constructing the string of differences. ("Fribble=" is technically a valid protover string.) This is now fixed, and the Rust version in that case will, analogous to (although safer than) C returning a NULL, return None. * REMOVE internal `contains_only_supported_protocols()` function. * REMOVE `all_supported()` function and refactor it into `UnvalidatedProtoEntry::all_supported()`. * REMOVE `parse_protocols_from_string_with_no_validation()` and refactor it into the more rusty implementation of `impl FromStr for UnvalidatedProtoEntry`. * REMOVE `protover_string_supports_protocol()` and refactor it into `UnvalidatedProtoEntry::supports_protocol()`. * REMOVE `protover_string_supports_protocol_or_later()` and refactor it into `UnvalidatedProtoEntry::supports_protocol_or_later()`. * FIXES part of #24031: https://bugs.torproject.org/24031 rust: Fix another C/Rust different in compute_vote(). This fixes the unittest from the prior commit by checking if the versions are empty before adding a protocol to a vote.
Diffstat (limited to 'src/rust/protover/lib.rs')
-rw-r--r--src/rust/protover/lib.rs3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/rust/protover/lib.rs b/src/rust/protover/lib.rs
index 9a9f92ed74..ce964196fd 100644
--- a/src/rust/protover/lib.rs
+++ b/src/rust/protover/lib.rs
@@ -31,9 +31,6 @@ extern crate tor_allocate;
#[macro_use]
extern crate tor_util;
-#[macro_use]
-extern crate tor_log;
-
pub mod errors;
pub mod protoset;
mod protover;