node_id formatting

This commit is contained in:
Dennis Schwerdel 2021-01-23 21:18:25 +01:00
parent 8e3cdbddbf
commit 8c4d86a101
1 changed files with 9 additions and 4 deletions

View File

@ -36,7 +36,7 @@ use crate::{
table::ClaimTable, table::ClaimTable,
traffic::TrafficStats, traffic::TrafficStats,
types::{Address, Mode, NodeId, Range, RangeList}, types::{Address, Mode, NodeId, Range, RangeList},
util::{addr_nice, resolve, CtrlC, Duration, MsgBuffer, StatsdMsg, Time, TimeSource} util::{addr_nice, bytes_to_hex, resolve, CtrlC, Duration, MsgBuffer, StatsdMsg, Time, TimeSource}
}; };
pub type Hash = BuildHasherDefault<FnvHasher>; pub type Hash = BuildHasherDefault<FnvHasher>;
@ -126,7 +126,12 @@ impl<D: Device, P: Protocol, S: Socket, TS: TimeSource> GenericCloud<D, P, S, TS
info!("Auto-claiming {} due to interface address", range); info!("Auto-claiming {} due to interface address", range);
claims.push(range); claims.push(range);
} }
Err(e) => error!("{}", e) Err(Error::DeviceIo(_, e)) if e.kind() == io::ErrorKind::AddrNotAvailable => {
info!("No address set on interface.")
}
Err(e) => {
error!("{}", e)
}
} }
} }
let now = TS::now(); let now = TS::now();
@ -644,7 +649,7 @@ impl<D: Device, P: Protocol, S: Socket, TS: TimeSource> GenericCloud<D, P, S, TS
("PEER", format!("{:?}", addr_nice(addr))), ("PEER", format!("{:?}", addr_nice(addr))),
("IFNAME", self.device.ifname().to_owned()), ("IFNAME", self.device.ifname().to_owned()),
("CLAIMS", info.claims.iter().map(|r| format!("{:?}", r)).collect::<Vec<String>>().join(" ")), ("CLAIMS", info.claims.iter().map(|r| format!("{:?}", r)).collect::<Vec<String>>().join(" ")),
("NODE_ID", format!("{:?}", info.node_id)), ("NODE_ID", bytes_to_hex(&info.node_id)),
], ],
true true
); );
@ -673,7 +678,7 @@ impl<D: Device, P: Protocol, S: Socket, TS: TimeSource> GenericCloud<D, P, S, TS
vec![ vec![
("PEER", format!("{:?}", addr)), ("PEER", format!("{:?}", addr)),
("IFNAME", self.device.ifname().to_owned()), ("IFNAME", self.device.ifname().to_owned()),
("NODE_ID", format!("{:?}", peer.node_id)), ("NODE_ID", bytes_to_hex(&peer.node_id)),
], ],
true true
); );