fix(wasm): use instant::{Duration, Instant} (#182)

This commit is contained in:
Max Inden
2023-12-06 19:07:09 +01:00
committed by GitHub
parent 68a9e3d079
commit 618b141786
4 changed files with 13 additions and 7 deletions

View File

@@ -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.

View File

@@ -1,6 +1,6 @@
[package]
name = "yamux"
version = "0.13.0"
version = "0.13.1"
authors = ["Parity Technologies <admin@parity.io>"]
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"

View File

@@ -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;

View File

@@ -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 {