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(wasm): use instant::{Duration, Instant} #182

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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
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