aboutsummaryrefslogtreecommitdiff
path: root/src/peering/fullmesh.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-10-12 13:18:24 +0200
committerAlex Auvolat <alex@adnab.me>2021-10-12 13:18:24 +0200
commit74e661febe14e165349497bca689a50c5edacc94 (patch)
tree1a19b11e5f182828ab6976a58ae9e99e785ee4df /src/peering/fullmesh.rs
parent7753b789b7aca87db4db7aed20e79a41ecb0b225 (diff)
downloadnetapp-74e661febe14e165349497bca689a50c5edacc94.tar.gz
netapp-74e661febe14e165349497bca689a50c5edacc94.zip
Fix clippy lints
Diffstat (limited to 'src/peering/fullmesh.rs')
-rw-r--r--src/peering/fullmesh.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs
index 9b55180..b0bbe45 100644
--- a/src/peering/fullmesh.rs
+++ b/src/peering/fullmesh.rs
@@ -103,7 +103,7 @@ impl KnownHosts {
let mut list = Vec::with_capacity(input.len());
for (id, peer) in input.iter() {
if peer.state == PeerConnState::Connected || peer.state == PeerConnState::Ourself {
- list.push((id.clone(), peer.addr));
+ list.push((*id, peer.addr));
}
}
list
@@ -134,7 +134,7 @@ impl FullMeshPeeringStrategy {
known_hosts.list.insert(
id,
PeerInfo {
- addr: addr,
+ addr,
state: PeerConnState::Waiting(0, Instant::now()),
last_seen: None,
ping: VecDeque::new(),
@@ -201,12 +201,12 @@ impl FullMeshPeeringStrategy {
Some(t) => Instant::now() - t > PING_INTERVAL,
};
if must_ping {
- to_ping.push(id.clone());
+ to_ping.push(*id);
}
}
PeerConnState::Waiting(_, t) => {
if Instant::now() >= t {
- to_retry.push(id.clone());
+ to_retry.push(*id);
}
}
_ => (),
@@ -234,7 +234,7 @@ impl FullMeshPeeringStrategy {
i + 1
);
h.state = PeerConnState::Trying(i);
- tokio::spawn(self.clone().try_connect(id, h.addr.clone()));
+ tokio::spawn(self.clone().try_connect(id, h.addr));
}
}
}
@@ -307,7 +307,7 @@ impl FullMeshPeeringStrategy {
}
async fn try_connect(self: Arc<Self>, id: NodeID, addr: SocketAddr) {
- let conn_result = self.netapp.clone().try_connect(addr, id.clone()).await;
+ 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);
let mut known_hosts = self.known_hosts.write().unwrap();
@@ -362,9 +362,9 @@ impl FullMeshPeeringStrategy {
for (id, info) in known_hosts.list.iter() {
let mut pings = info.ping.iter().cloned().collect::<Vec<_>>();
pings.sort();
- if pings.len() > 0 {
+ if !pings.is_empty() {
ret.push(PeerInfoPub {
- id: id.clone(),
+ id: *id,
addr: info.addr,
state: info.state,
last_seen: info.last_seen,
@@ -379,7 +379,7 @@ impl FullMeshPeeringStrategy {
});
} else {
ret.push(PeerInfoPub {
- id: id.clone(),
+ id: *id,
addr: info.addr,
state: info.state,
last_seen: info.last_seen,