Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols/{relay,dcutr}: Replace std::time::SystemTime with instant::SystemTime #2991

Merged
merged 8 commits into from
Oct 12, 2022
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;
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
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