refactor(swarm): prefer Instant::elapsed
This commit is contained in:
parent
828bfc4b75
commit
94427ce41e
@ -84,9 +84,7 @@ impl SwarmApi {
|
|||||||
let rtt = self.roundtrip_times.get(peer).cloned().or_else(|| {
|
let rtt = self.roundtrip_times.get(peer).cloned().or_else(|| {
|
||||||
// If no rountrip time yet, just return time since connected.
|
// If no rountrip time yet, just return time since connected.
|
||||||
// See: https://github.com/rs-ipfs/rust-ipfs/issues/178
|
// See: https://github.com/rs-ipfs/rust-ipfs/issues/178
|
||||||
self.connected_times.get(peer).and_then(|connected_time| {
|
self.connected_times.get(peer).map(Instant::elapsed)
|
||||||
Instant::now().checked_duration_since(*connected_time)
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
conns.first().map(|any| Connection {
|
conns.first().map(|any| Connection {
|
||||||
|
Loading…
Reference in New Issue
Block a user