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

fix: Replace std::time::Instant by wasm_timer::Instant #2135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion protocols/gossipsub/src/peer_score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use libp2p_core::PeerId;
use log::{debug, trace, warn};
use std::collections::{hash_map, HashMap, HashSet};
use std::net::IpAddr;
use std::time::{Duration, Instant};
use std::time::Duration;
use wasm_timer::Instant;

mod params;
use crate::error::ValidationError;
Expand Down
4 changes: 3 additions & 1 deletion protocols/gossipsub/src/time_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use std::collections::hash_map::{
Entry::{Occupied, Vacant},
};
use std::collections::VecDeque;
use std::time::{Duration, Instant};
use std::time::Duration;
use wasm_timer::Instant;


struct ExpiringElement<Element> {
/// The element that expires
Expand Down
3 changes: 2 additions & 1 deletion protocols/kad/src/kbucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ pub use entry::*;
use arrayvec::{self, ArrayVec};
use bucket::KBucket;
use std::collections::VecDeque;
use std::time::{Duration, Instant};
use std::time::Duration;
use wasm_timer::Instant;

/// Maximum number of k-buckets.
const NUM_BUCKETS: usize = 256;
Expand Down
1 change: 1 addition & 0 deletions protocols/mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rand = "0.8.3"
smallvec = "1.6.1"
socket2 = { version = "0.4.0", features = ["all"] }
void = "1.0.2"
wasm-timer = "0.2.4"

[dev-dependencies]
async-std = "1.9.0"
Expand Down
3 changes: 2 additions & 1 deletion protocols/mdns/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ use std::{
pin::Pin,
task::Context,
task::Poll,
time::{Duration, Instant},
time::Duration,
};
use wasm_timer::Instant;

lazy_static! {
static ref IPV4_MDNS_MULTICAST_ADDRESS: SocketAddr =
Expand Down