diff --git a/CHANGELOG.md b/CHANGELOG.md index 295cf9d..62838a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.13.1 + +- Fix WASM support using `instant::{Duration, Instant}` instead of `std::time::{Duration, Instant}`. + See [PR 179](https://github.com/libp2p/rust-yamux/pull/179). + # 0.13.0 - Introduce dynamic stream receive window auto-tuning. diff --git a/yamux/Cargo.toml b/yamux/Cargo.toml index 3cac8f0..0fa25e0 100644 --- a/yamux/Cargo.toml +++ b/yamux/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "yamux" -version = "0.13.0" +version = "0.13.1" authors = ["Parity Technologies "] license = "Apache-2.0 OR MIT" description = "Multiplexer over reliable, ordered connections" @@ -11,6 +11,7 @@ edition = "2021" [dependencies] futures = { version = "0.3.12", default-features = false, features = ["std", "executor"] } +instant = "0.1" log = "0.4.8" nohash-hasher = "0.2" parking_lot = "0.12" diff --git a/yamux/src/connection/rtt.rs b/yamux/src/connection/rtt.rs index 56938d7..5987b70 100644 --- a/yamux/src/connection/rtt.rs +++ b/yamux/src/connection/rtt.rs @@ -10,11 +10,9 @@ //! Connection round-trip time measurement -use std::{ - sync::Arc, - time::{Duration, Instant}, -}; +use std::sync::Arc; +use instant::{Duration, Instant}; use parking_lot::Mutex; use crate::connection::Action; diff --git a/yamux/src/connection/stream/flow_control.rs b/yamux/src/connection/stream/flow_control.rs index 9d9bd6c..4fa15bd 100644 --- a/yamux/src/connection/stream/flow_control.rs +++ b/yamux/src/connection/stream/flow_control.rs @@ -1,5 +1,6 @@ -use std::{cmp, sync::Arc, time::Instant}; +use std::{cmp, sync::Arc}; +use instant::Instant; use parking_lot::Mutex; use crate::{connection::rtt::Rtt, Config, DEFAULT_CREDIT}; @@ -211,6 +212,7 @@ impl Drop for FlowController { #[cfg(test)] mod tests { use super::*; + use instant::Duration; use quickcheck::{GenRange, QuickCheck}; #[derive(Debug)] @@ -270,7 +272,7 @@ mod tests { ..max_connection_minus_default.saturating_add(1), ))); let last_window_update = - Instant::now() - std::time::Duration::from_secs(g.gen_range(0..(60 * 60 * 24))); + Instant::now() - Duration::from_secs(g.gen_range(0..(60 * 60 * 24))); let send_window = g.gen_range(0..u32::MAX); Self {