Skip to content

Commit

Permalink
protocols/{relay,dcutr}: Replace std::time::SystemTime with `instan…
Browse files Browse the repository at this point in the history
…t::SystemTime` (#2991)
  • Loading branch information
thomaseizinger authored Oct 12, 2022
1 parent f711dd5 commit eb10af7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions protocols/dcutr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Update to `libp2p-swarm` `v0.40.0`.

- Fix WASM compilation. See [PR 2991].

[PR 2991]: https://github.com/libp2p/rust-libp2p/pull/2991/

# 0.6.0

- Update to `libp2p-swarm` `v0.39.0`.
Expand Down
2 changes: 1 addition & 1 deletion protocols/dcutr/src/protocol/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use crate::message_proto::{hole_punch, HolePunch};
use asynchronous_codec::Framed;
use futures::{future::BoxFuture, prelude::*};
use futures_timer::Delay;
use instant::Instant;
use libp2p_core::{multiaddr::Protocol, upgrade, Multiaddr};
use libp2p_swarm::NegotiatedSubstream;
use std::convert::TryFrom;
use std::iter;
use std::time::Instant;
use thiserror::Error;

pub struct Upgrade {
Expand Down
4 changes: 4 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Update to `libp2p-swarm` `v0.40.0`.

- Fix WASM compilation. See [PR 2991].

[PR 2991]: https://github.com/libp2p/rust-libp2p/pull/2991/

# 0.12.0

- Update to `libp2p-swarm` `v0.39.0`.
Expand Down
4 changes: 2 additions & 2 deletions protocols/relay/src/v2/protocol/inbound_hop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ use crate::v2::protocol::{HOP_PROTOCOL_NAME, MAX_MESSAGE_SIZE};
use asynchronous_codec::{Framed, FramedParts};
use bytes::Bytes;
use futures::{future::BoxFuture, prelude::*};
use instant::{Duration, SystemTime};
use libp2p_core::{upgrade, Multiaddr, PeerId};
use libp2p_swarm::NegotiatedSubstream;
use std::convert::TryInto;
use std::iter;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use thiserror::Error;

pub struct Upgrade {
Expand Down Expand Up @@ -142,7 +142,7 @@ impl ReservationReq {
reservation: Some(Reservation {
addrs: addrs.into_iter().map(|a| a.to_vec()).collect(),
expire: (SystemTime::now() + self.reservation_duration)
.duration_since(UNIX_EPOCH)
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs(),
voucher: None,
Expand Down
4 changes: 2 additions & 2 deletions protocols/relay/src/v2/protocol/outbound_hop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use asynchronous_codec::{Framed, FramedParts};
use bytes::Bytes;
use futures::{future::BoxFuture, prelude::*};
use futures_timer::Delay;
use instant::{Duration, SystemTime};
use libp2p_core::{upgrade, Multiaddr, PeerId};
use libp2p_swarm::NegotiatedSubstream;
use std::convert::TryFrom;
use std::iter;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use thiserror::Error;

pub enum Upgrade {
Expand Down Expand Up @@ -134,7 +134,7 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for Upgrade {
.expire
.checked_sub(
SystemTime::now()
.duration_since(UNIX_EPOCH)
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs(),
)
Expand Down

0 comments on commit eb10af7

Please sign in to comment.