From b922c869f018bb7dd4a61921c5eb57466246341f Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Thu, 27 Feb 2020 14:42:46 +0000 Subject: [PATCH] Got rid of compiler warnings --- mixnode/src/main.rs | 1 - mixnode/src/mix_peer.rs | 45 --------------------------- mixnode/src/node/packet_forwarding.rs | 4 +-- mixnode/src/node/packet_processing.rs | 2 +- 4 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 mixnode/src/mix_peer.rs diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index d073b1385c..994f74f23d 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -3,7 +3,6 @@ use clap::{App, ArgMatches}; pub mod built_info; mod commands; mod config; -mod mix_peer; mod node; fn main() { diff --git a/mixnode/src/mix_peer.rs b/mixnode/src/mix_peer.rs deleted file mode 100644 index 82be36c475..0000000000 --- a/mixnode/src/mix_peer.rs +++ /dev/null @@ -1,45 +0,0 @@ -use addressing; -use addressing::AddressTypeError; -use sphinx::route::NodeAddressBytes; -use std::error::Error; -use std::net::SocketAddr; -use tokio::prelude::*; - -#[derive(Debug)] -pub struct MixPeer { - connection: SocketAddr, -} - -#[derive(Debug)] -pub enum MixPeerError { - InvalidAddressError, -} - -impl From for MixPeerError { - fn from(_: AddressTypeError) -> Self { - use MixPeerError::*; - - InvalidAddressError - } -} - -impl MixPeer { - // note that very soon `next_hop_address` will be changed to `next_hop_metadata` - pub fn new(next_hop_address: NodeAddressBytes) -> Result { - let next_hop_socket_address = - addressing::socket_address_from_encoded_bytes(next_hop_address.to_bytes())?; - Ok(MixPeer { - connection: next_hop_socket_address, - }) - } - - pub async fn send(&self, bytes: Vec) -> Result<(), Box> { - let mut stream = tokio::net::TcpStream::connect(self.connection).await?; - stream.write_all(&bytes).await?; - Ok(()) - } - - pub fn stringify(&self) -> String { - self.connection.to_string() - } -} diff --git a/mixnode/src/node/packet_forwarding.rs b/mixnode/src/node/packet_forwarding.rs index 1378c543af..8335322081 100644 --- a/mixnode/src/node/packet_forwarding.rs +++ b/mixnode/src/node/packet_forwarding.rs @@ -11,12 +11,12 @@ pub(crate) struct PacketForwarder<'a> { conn_rx: mpsc::UnboundedReceiver<(SocketAddr, Vec)>, } -impl<'a: 'static> PacketForwarder<'a> { +impl PacketForwarder<'static> { pub(crate) async fn new( initial_endpoints: Vec, initial_reconnection_backoff: Duration, maximum_reconnection_backoff: Duration, - ) -> PacketForwarder<'a> { + ) -> PacketForwarder<'static> { let tcp_client_config = multi_tcp_client::Config::new( initial_endpoints, initial_reconnection_backoff, diff --git a/mixnode/src/node/packet_processing.rs b/mixnode/src/node/packet_processing.rs index ad9eb66730..ec6187e9aa 100644 --- a/mixnode/src/node/packet_processing.rs +++ b/mixnode/src/node/packet_processing.rs @@ -8,7 +8,6 @@ use sphinx::{ProcessedPacket, SphinxPacket}; use std::net::SocketAddr; use std::ops::Deref; use std::sync::Arc; -use std::time::Duration; #[derive(Debug)] pub enum MixProcessingError { @@ -20,6 +19,7 @@ pub enum MixProcessingError { pub enum MixProcessingResult { ForwardHop(SocketAddr, Vec), + #[allow(dead_code)] LoopMessage, }