Slightly decreases the aggressive logging in mix traffic controller
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
use futures::channel::mpsc;
|
||||
use futures::StreamExt;
|
||||
use log::*;
|
||||
use log::{debug, error, info, trace};
|
||||
use sphinx::SphinxPacket;
|
||||
use std::io;
|
||||
use std::io::prelude::*;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
pub(crate) struct MixMessage(SocketAddr, SphinxPacket);
|
||||
@@ -17,21 +15,22 @@ impl MixMessage {
|
||||
pub(crate) struct MixTrafficController;
|
||||
|
||||
impl MixTrafficController {
|
||||
// this was way more difficult to implement than what this code may suggest...
|
||||
pub(crate) async fn run(mut rx: mpsc::UnboundedReceiver<MixMessage>) {
|
||||
info!("Mix Traffic Controller started!");
|
||||
let mix_client = mix_client::MixClient::new();
|
||||
while let Some(mix_message) = rx.next().await {
|
||||
info!(
|
||||
"[MIX TRAFFIC CONTROL] - got a mix_message for {:?}",
|
||||
mix_message.0
|
||||
);
|
||||
debug!("Got a mix_message for {:?}", mix_message.0);
|
||||
let send_res = mix_client.send(mix_message.1, mix_message.0).await;
|
||||
match send_res {
|
||||
Ok(_) => {
|
||||
print!(".");
|
||||
io::stdout().flush().ok().expect("Could not flush stdout");
|
||||
trace!("sent a mix message");
|
||||
}
|
||||
Err(e) => error!("We failed to send the message :( - {:?}", e),
|
||||
// TODO: should there be some kind of threshold of failed messages
|
||||
// that if reached, the application blows?
|
||||
Err(e) => error!(
|
||||
"We failed to send the message to {} :( - {:?}",
|
||||
mix_message.0, e
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user