Skip to content

Commit

Permalink
fix(wasm): use instant::{Duration, Instant} (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden authored Dec 6, 2023
1 parent 68a9e3d commit 618b141
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion yamux/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yamux"
version = "0.13.0"
version = "0.13.1"
authors = ["Parity Technologies <[email protected]>"]
license = "Apache-2.0 OR MIT"
description = "Multiplexer over reliable, ordered connections"
Expand All @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions yamux/src/connection/rtt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions yamux/src/connection/stream/flow_control.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -211,6 +212,7 @@ impl Drop for FlowController {
#[cfg(test)]
mod tests {
use super::*;
use instant::Duration;
use quickcheck::{GenRange, QuickCheck};

#[derive(Debug)]
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 618b141

Please sign in to comment.