Merge branch 'develop' of github.com:nymtech/nym into develop

This commit is contained in:
Dave Hrycyszyn
2020-01-07 13:36:26 +00:00
5 changed files with 19 additions and 9 deletions
-1
View File
@@ -1698,7 +1698,6 @@ dependencies = [
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+14 -6
View File
@@ -177,22 +177,30 @@ impl NymClient {
) {
loop {
println!("[OUT QUEUE] here I will be sending real traffic (or loop cover if nothing is available)");
select! {
// TODO: consider replacing select macro with our own proper future definition with polling
let traffic_message = select! {
real_message = input_rx.next() => {
println!("[OUT QUEUE] - we got a real message!");
let real_message = real_message.expect("The channel must have closed! - if the client hasn't crashed, it should have!");
if real_message.is_none() {
eprintln!("Unexpected 'None' real message!");
std::process::exit(1);
}
let real_message = real_message.unwrap();
println!("real: {:?}", real_message);
let encapsulated_message = utils::sphinx::encapsulate_message(real_message.0, real_message.1, &topology);
mix_tx.send(MixMessage(encapsulated_message.0, encapsulated_message.1)).await.unwrap();
utils::sphinx::encapsulate_message(real_message.0, real_message.1, &topology)
},
default => {
println!("[OUT QUEUE] - no real message - going to send extra loop cover");
let cover_message = utils::sphinx::loop_cover_message(our_info.address, our_info.identifier, &topology);
mix_tx.send(MixMessage(cover_message.0, cover_message.1)).await.unwrap();
utils::sphinx::loop_cover_message(our_info.address, our_info.identifier, &topology)
}
};
mix_tx
.send(MixMessage(traffic_message.0, traffic_message.1))
.await
.unwrap();
let delay_duration = Duration::from_secs_f64(MESSAGE_SENDING_AVERAGE_DELAY);
tokio::time::delay_for(delay_duration).await;
}
+2
View File
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]
pub mod clients;
pub mod identity;
pub mod persistence;
+3 -1
View File
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]
use clap::{App, Arg, ArgMatches, SubCommand};
use std::process;
@@ -10,7 +12,7 @@ mod utils;
fn main() {
let arg_matches = App::new("Nym Client")
.version("0.1.0")
.version(built_info::PKG_VERSION)
.author("Nymtech")
.about("Implementation of the Nym Client")
.subcommand(
-1
View File
@@ -351,7 +351,6 @@ dependencies = [
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",