Updated directory_client reqwest to 0.10 (#226)

* Updated directory_client reqwest to 0.10

* Using consistent syntax
This commit is contained in:
Jędrzej Stuczyński
2020-05-12 12:52:31 +01:00
committed by GitHub
parent f47b7cfb13
commit ff2e24afbc
25 changed files with 759 additions and 480 deletions
+9 -6
View File
@@ -13,7 +13,6 @@
// limitations under the License.
use directory_client::metrics::MixMetric;
use directory_client::requests::metrics_mixes_post::MetricsMixPoster;
use directory_client::DirectoryClient;
use futures::channel::mpsc;
use futures::lock::Mutex;
@@ -141,11 +140,15 @@ impl MetricsSender {
self.metrics_informer.log_report_stats(received, &sent);
self.metrics_informer.try_log_running_stats();
match self.directory_client.metrics_post.post(&MixMetric {
pub_key: self.pub_key_str.clone(),
received,
sent,
}) {
match self
.directory_client
.post_mix_metrics(MixMetric {
pub_key: self.pub_key_str.clone(),
received,
sent,
})
.await
{
Err(err) => error!("failed to send metrics - {:?}", err),
Ok(_) => debug!("sent metrics information"),
}
+4 -2
View File
@@ -100,9 +100,11 @@ impl MixNode {
.start(self.runtime.handle())
}
fn check_if_same_ip_node_exists(&self) -> Option<String> {
fn check_if_same_ip_node_exists(&mut self) -> Option<String> {
// TODO: once we change to graph topology this here will need to be updated!
let topology = Topology::new(self.config.get_presence_directory_server());
let topology = self
.runtime
.block_on(Topology::new(self.config.get_presence_directory_server()));
let existing_mixes_presence = topology.mix_nodes;
existing_mixes_presence
.iter()
+7 -4
View File
@@ -14,7 +14,6 @@
use crate::built_info;
use directory_client::presence::mixnodes::MixNodePresence;
use directory_client::requests::presence_mixnodes_post::PresenceMixNodesPoster;
use directory_client::DirectoryClient;
use log::{error, trace};
use std::time::Duration;
@@ -77,8 +76,12 @@ impl Notifier {
}
}
fn notify(&self) {
match self.net_client.presence_mix_nodes_post.post(&self.presence) {
async fn notify(&self) {
match self
.net_client
.post_mixnode_presence(self.presence.clone())
.await
{
Err(err) => error!("failed to send presence - {:?}", err),
Ok(_) => trace!("sent presence information"),
}
@@ -89,7 +92,7 @@ impl Notifier {
loop {
// set the deadline in the future
let sending_delay = tokio::time::delay_for(self.sending_delay);
self.notify();
self.notify().await;
// wait for however much is left
sending_delay.await;
}