Feature/very minor refactoring (#188)
* log statement for forwarding traffic * Mixnode logging intent to forward packet * Presence logging level decrease + making things less public * Default adjustments + human readable equivalents in comments * Do not immediately refresh topology on start
This commit is contained in:
committed by
GitHub
parent
8f4dff0074
commit
fda308694e
@@ -14,6 +14,7 @@
|
||||
|
||||
use futures::channel::mpsc;
|
||||
use futures::StreamExt;
|
||||
use log::*;
|
||||
use std::net::SocketAddr;
|
||||
use std::time::Duration;
|
||||
use tokio::runtime::Handle;
|
||||
@@ -50,6 +51,7 @@ impl PacketForwarder {
|
||||
let sender_channel = self.conn_tx.clone();
|
||||
handle.spawn(async move {
|
||||
while let Some((address, packet)) = self.conn_rx.next().await {
|
||||
trace!("Going to forward packet to {:?}", address);
|
||||
// as a mix node we don't care about responses, we just want to fire packets
|
||||
// as quickly as possible
|
||||
self.tcp_client.send(address, packet, false).await.unwrap(); // if we're not waiting for response, we MUST get an Ok
|
||||
|
||||
@@ -16,12 +16,12 @@ use crate::built_info;
|
||||
use directory_client::presence::mixnodes::MixNodePresence;
|
||||
use directory_client::requests::presence_mixnodes_post::PresenceMixNodesPoster;
|
||||
use directory_client::DirectoryClient;
|
||||
use log::{debug, error};
|
||||
use log::{error, trace};
|
||||
use std::time::Duration;
|
||||
use tokio::runtime::Handle;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
pub struct NotifierConfig {
|
||||
pub(crate) struct NotifierConfig {
|
||||
location: String,
|
||||
directory_server: String,
|
||||
announce_host: String,
|
||||
@@ -31,7 +31,7 @@ pub struct NotifierConfig {
|
||||
}
|
||||
|
||||
impl NotifierConfig {
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
location: String,
|
||||
directory_server: String,
|
||||
announce_host: String,
|
||||
@@ -50,14 +50,14 @@ impl NotifierConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Notifier {
|
||||
pub(crate) struct Notifier {
|
||||
net_client: directory_client::Client,
|
||||
presence: MixNodePresence,
|
||||
sending_delay: Duration,
|
||||
}
|
||||
|
||||
impl Notifier {
|
||||
pub fn new(config: NotifierConfig) -> Notifier {
|
||||
pub(crate) fn new(config: NotifierConfig) -> Notifier {
|
||||
let directory_client_cfg = directory_client::Config {
|
||||
base_url: config.directory_server,
|
||||
};
|
||||
@@ -80,7 +80,7 @@ impl Notifier {
|
||||
fn notify(&self) {
|
||||
match self.net_client.presence_mix_nodes_post.post(&self.presence) {
|
||||
Err(err) => error!("failed to send presence - {:?}", err),
|
||||
Ok(_) => debug!("sent presence information"),
|
||||
Ok(_) => trace!("sent presence information"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user