Logging adjustment (#585)

* Reduced severity of common harmless warnings

* Changed the same ip node warning

* More explicit error on network address binding failure
This commit is contained in:
Jędrzej Stuczyński
2021-04-28 14:11:04 +01:00
committed by GitHub
parent 6f173ffebd
commit a521bc0f54
8 changed files with 38 additions and 18 deletions
+9 -3
View File
@@ -4,6 +4,7 @@
use crate::node::listener::connection_handler::ConnectionHandler;
use log::*;
use std::net::SocketAddr;
use std::process;
use tokio::net::TcpListener;
use tokio::task::JoinHandle;
@@ -19,9 +20,14 @@ impl Listener {
}
async fn run(&mut self, connection_handler: ConnectionHandler) {
let listener = TcpListener::bind(self.address)
.await
.expect("Failed to create TCP listener");
let listener = match TcpListener::bind(self.address).await {
Ok(listener) => listener,
Err(err) => {
error!("Failed to bind to {} - {}. Are you sure nothing else is running on the specified port and your user has sufficient permission to bind to the requested address?", self.address, err);
process::exit(1);
}
};
loop {
match listener.accept().await {
Ok((socket, remote_addr)) => {
+1 -1
View File
@@ -128,7 +128,7 @@ impl MixNode {
runtime.block_on(async {
if let Some(duplicate_node_key) = self.check_if_same_ip_node_exists().await {
if duplicate_node_key == self.identity_keypair.public_key().to_base58_string() {
warn!("We seem to have not unregistered after going offline - there's a node with identical identity and announce-host us as registered.")
warn!("You seem to have bonded your mixnode before starting it - that's highly unrecommended as in the future it will result in slashing");
} else {
error!(
"Our announce-host is identical to an existing node's announce-host! (its key is {:?})",