summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-16 21:33:38 -0400
committerNick Mathewson <nickm@torproject.org>2018-10-16 21:33:38 -0400
commit34cd1fc52396175a98837f856fc59a0c362cb8a2 (patch)
treeb86fe032f9c16f79f084fd52fca808eb4af45481
parent63c5e09a4093dc72f11c08078fe81c34c5d40ba5 (diff)
parent5e74db95c2a38eaa5736688ff4d2580d95c5e059 (diff)
downloadtor-34cd1fc52396175a98837f856fc59a0c362cb8a2.tar.gz
tor-34cd1fc52396175a98837f856fc59a0c362cb8a2.zip
Merge remote-tracking branch 'tor-github/pr/406'
-rw-r--r--src/rust/external/external.rs3
-rw-r--r--src/rust/protover/protoset.rs2
-rw-r--r--src/rust/protover/protover.rs50
3 files changed, 28 insertions, 27 deletions
diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs
index d342fe096e..aa43d2a928 100644
--- a/src/rust/external/external.rs
+++ b/src/rust/external/external.rs
@@ -32,7 +32,6 @@ extern "C" {
}
/// Return true if Tor was built to use NSS.
-pub fn c_tor_is_using_nss() -> bool
-{
+pub fn c_tor_is_using_nss() -> bool {
0 != unsafe { tor_is_using_nss() }
}
diff --git a/src/rust/protover/protoset.rs b/src/rust/protover/protoset.rs
index c447186098..3bfa7815f6 100644
--- a/src/rust/protover/protoset.rs
+++ b/src/rust/protover/protoset.rs
@@ -290,7 +290,7 @@ impl ProtoSet {
});
let pairs = pairs.collect();
- ProtoSet::is_ok(ProtoSet{ pairs }).expect("should be already sorted")
+ ProtoSet::is_ok(ProtoSet { pairs }).expect("should be already sorted")
}
}
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 43822a3f15..8624afeafa 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -124,15 +124,15 @@ impl From<Protocol> for UnknownProtocol {
}
}
-#[cfg(feature="test_linking_hack")]
+#[cfg(feature = "test_linking_hack")]
fn have_linkauth_v1() -> bool {
true
}
-#[cfg(not(feature="test_linking_hack"))]
+#[cfg(not(feature = "test_linking_hack"))]
fn have_linkauth_v1() -> bool {
use external::c_tor_is_using_nss;
- ! c_tor_is_using_nss()
+ !c_tor_is_using_nss()
}
/// Get a CStr representation of current supported protocols, for
@@ -152,29 +152,31 @@ fn have_linkauth_v1() -> bool {
///
// C_RUST_COUPLED: protover.c `protover_get_supported_protocols`
pub(crate) fn get_supported_protocols_cstr() -> &'static CStr {
- if ! have_linkauth_v1() {
- cstr!("Cons=1-2 \
- Desc=1-2 \
- DirCache=1-2 \
- HSDir=1-2 \
- HSIntro=3-4 \
- HSRend=1-2 \
- Link=1-5 \
- LinkAuth=3 \
- Microdesc=1-2 \
- Relay=1-2"
+ if !have_linkauth_v1() {
+ cstr!(
+ "Cons=1-2 \
+ Desc=1-2 \
+ DirCache=1-2 \
+ HSDir=1-2 \
+ HSIntro=3-4 \
+ HSRend=1-2 \
+ Link=1-5 \
+ LinkAuth=3 \
+ Microdesc=1-2 \
+ Relay=1-2"
)
} else {
- cstr!("Cons=1-2 \
- Desc=1-2 \
- DirCache=1-2 \
- HSDir=1-2 \
- HSIntro=3-4 \
- HSRend=1-2 \
- Link=1-5 \
- LinkAuth=1,3 \
- Microdesc=1-2 \
- Relay=1-2"
+ cstr!(
+ "Cons=1-2 \
+ Desc=1-2 \
+ DirCache=1-2 \
+ HSDir=1-2 \
+ HSIntro=3-4 \
+ HSRend=1-2 \
+ Link=1-5 \
+ LinkAuth=1,3 \
+ Microdesc=1-2 \
+ Relay=1-2"
)
}
}