aboutsummaryrefslogtreecommitdiff
path: root/src/peering/fullmesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/peering/fullmesh.rs')
-rw-r--r--src/peering/fullmesh.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs
index cf10279..a5b2c3a 100644
--- a/src/peering/fullmesh.rs
+++ b/src/peering/fullmesh.rs
@@ -236,7 +236,7 @@ impl FullMeshPeeringStrategy {
let mut to_ping = vec![];
let mut to_retry = vec![];
for (id, info) in known_hosts.list.iter() {
- trace!("{}, {:?}", hex::encode(id), info);
+ trace!("{}, {:?}", hex::encode(&id[..8]), info);
match info.state {
PeerConnState::Connected => {
let must_ping = match info.last_seen {
@@ -273,7 +273,7 @@ impl FullMeshPeeringStrategy {
if let PeerConnState::Waiting(i, _) = h.state {
info!(
"Retrying connection to {} at {} ({})",
- hex::encode(&id),
+ hex::encode(&id[..8]),
h.addr,
i + 1
);
@@ -344,16 +344,16 @@ impl FullMeshPeeringStrategy {
debug!(
"Sending ping {} to {} at {:?}",
ping_id,
- hex::encode(id),
+ hex::encode(&id[..8]),
ping_time
);
match self.ping_endpoint.call(&id, &ping_msg, PRIO_HIGH).await {
- Err(e) => warn!("Error pinging {}: {}", hex::encode(id), e),
+ Err(e) => warn!("Error pinging {}: {}", hex::encode(&id[..8]), e),
Ok(ping_resp) => {
let resp_time = Instant::now();
debug!(
"Got ping response from {} at {:?}",
- hex::encode(id),
+ hex::encode(&id[..8]),
resp_time
);
{
@@ -409,7 +409,7 @@ impl FullMeshPeeringStrategy {
async fn try_connect(self: Arc<Self>, id: NodeID, addr: SocketAddr) {
let conn_result = self.netapp.clone().try_connect(addr, id).await;
if let Err(e) = conn_result {
- warn!("Error connecting to {}: {}", hex::encode(id), e);
+ warn!("Error connecting to {}: {}", hex::encode(&id[..8]), e);
let mut known_hosts = self.known_hosts.write().unwrap();
if let Some(host) = known_hosts.list.get_mut(&id) {
host.state = match host.state {
@@ -438,7 +438,11 @@ impl FullMeshPeeringStrategy {
self.update_public_peer_list(&known_hosts);
}
} else {
- info!("Successfully connected to {} at {}", hex::encode(&id), addr);
+ info!(
+ "Successfully connected to {} at {}",
+ hex::encode(&id[..8]),
+ addr
+ );
let mut known_hosts = self.known_hosts.write().unwrap();
if let Some(host) = known_hosts.list.get_mut(&id) {
host.state = PeerConnState::Connected;
@@ -461,7 +465,7 @@ impl FullMeshPeeringStrategy {
fn on_disconnected(self: Arc<Self>, id: NodeID, is_incoming: bool) {
if !is_incoming {
- info!("Connection to {} was closed", hex::encode(id));
+ info!("Connection to {} was closed", hex::encode(&id[..8]));
let mut known_hosts = self.known_hosts.write().unwrap();
if let Some(host) = known_hosts.list.get_mut(&id) {
host.state = PeerConnState::Waiting(0, Instant::now());
@@ -493,7 +497,7 @@ impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy {
id: ping.id,
peer_list_hash: self.known_hosts.read().unwrap().hash,
};
- debug!("Ping from {}", hex::encode(&from));
+ debug!("Ping from {}", hex::encode(&from[..8]));
ping_resp
}
}