Defaults in the config + using said fields when starting mixnode

This commit is contained in:
Jedrzej Stuczynski
2020-02-04 15:17:25 +00:00
parent 448fc4a361
commit bed0badc15
3 changed files with 27 additions and 5 deletions
+2
View File
@@ -248,6 +248,7 @@ impl MixNode {
self.config.get_announce_address(),
self.sphinx_keypair.public_key().to_base58_string(),
self.config.get_layer(),
self.config.get_presence_sending_delay(),
);
rt.spawn({
let presence_notifier = presence::Notifier::new(notifier_config);
@@ -272,6 +273,7 @@ impl MixNode {
metrics,
directory_cfg,
self.sphinx_keypair.public_key().to_base58_string(),
self.config.get_metrics_sending_delay(),
));
// Spawn the root task
+4 -5
View File
@@ -3,13 +3,12 @@ use directory_client::presence::mixnodes::MixNodePresence;
use directory_client::requests::presence_mixnodes_post::PresenceMixNodesPoster;
use directory_client::DirectoryClient;
use log::{debug, error};
use std::time;
use std::time::Duration;
pub struct Notifier {
pub net_client: directory_client::Client,
presence: MixNodePresence,
sending_delay: time::Duration,
sending_delay: Duration,
}
pub struct NotifierConfig {
@@ -17,7 +16,7 @@ pub struct NotifierConfig {
announce_host: String,
pub_key_string: String,
layer: u64,
sending_delay: time::Duration,
sending_delay: Duration,
}
impl NotifierConfig {
@@ -26,7 +25,7 @@ impl NotifierConfig {
announce_host: String,
pub_key_string: String,
layer: u64,
sending_delay: time::Duration,
sending_delay: Duration,
) -> Self {
NotifierConfig {
directory_server,
@@ -68,7 +67,7 @@ impl Notifier {
pub async fn run(self) {
loop {
self.notify();
tokio::time::delay_for(self.sending_delay).await;
tokio::delay_for(self.sending_delay).await;
}
}
}