Skip to content

Commit 3820009

Browse files
committed
Upgrade futures-bounded to 0.3.0
1 parent e2946a7 commit 3820009

File tree

13 files changed

+33
-23
lines changed

13 files changed

+33
-23
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ libp2p-yamux = { version = "0.47.0", path = "muxers/yamux" }
121121
asynchronous-codec = { version = "0.7.0" }
122122
env_logger = "0.11"
123123
futures = "0.3.30"
124-
futures-bounded = { version = "0.2.4" }
124+
futures-bounded = { version = "0.3.0", features = ["futures-timer"] }
125125
futures-rustls = { version = "0.26.0", default-features = false }
126126
getrandom = "0.2"
127127
if-watch = "3.2.1"

protocols/autonat/src/v2/client/handler/dial_back.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
};
77

88
use futures::channel::oneshot;
9-
use futures_bounded::StreamSet;
9+
use futures_bounded::{Delay, StreamSet};
1010
use libp2p_core::upgrade::{DeniedUpgrade, ReadyUpgrade};
1111
use libp2p_swarm::{
1212
handler::{ConnectionEvent, FullyNegotiatedInbound, ListenUpgradeError},
@@ -22,7 +22,7 @@ pub struct Handler {
2222
impl Handler {
2323
pub(crate) fn new() -> Self {
2424
Self {
25-
inbound: StreamSet::new(Duration::from_secs(5), 2),
25+
inbound: StreamSet::new(|| Delay::futures_timer(Duration::from_secs(5)), 2),
2626
}
2727
}
2828
}

protocols/autonat/src/v2/client/handler/dial_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
};
99

1010
use futures::{channel::oneshot, AsyncWrite};
11-
use futures_bounded::FuturesMap;
11+
use futures_bounded::{Delay, FuturesMap};
1212
use libp2p_core::{
1313
upgrade::{DeniedUpgrade, ReadyUpgrade},
1414
Multiaddr,
@@ -91,7 +91,7 @@ impl Handler {
9191
pub(crate) fn new() -> Self {
9292
Self {
9393
queued_events: VecDeque::new(),
94-
outbound: FuturesMap::new(Duration::from_secs(10), 10),
94+
outbound: FuturesMap::new(|| Delay::futures_timer(Duration::from_secs(10)), 10),
9595
queued_streams: VecDeque::default(),
9696
}
9797
}

protocols/autonat/src/v2/server/handler/dial_back.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
};
77

88
use futures::{AsyncRead, AsyncWrite};
9-
use futures_bounded::FuturesSet;
9+
use futures_bounded::{Delay, FuturesSet};
1010
use libp2p_core::upgrade::{DeniedUpgrade, ReadyUpgrade};
1111
use libp2p_swarm::{
1212
handler::{ConnectionEvent, DialUpgradeError, FullyNegotiatedOutbound},
@@ -33,7 +33,7 @@ impl Handler {
3333
Self {
3434
pending_nonce: Some(cmd),
3535
requested_substream_nonce: None,
36-
outbound: FuturesSet::new(Duration::from_secs(10), 5),
36+
outbound: FuturesSet::new(|| Delay::futures_timer(Duration::from_secs(10)), 5),
3737
}
3838
}
3939
}

protocols/autonat/src/v2/server/handler/dial_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use futures::{
1010
channel::{mpsc, oneshot},
1111
AsyncRead, AsyncWrite, SinkExt, StreamExt,
1212
};
13-
use futures_bounded::FuturesSet;
13+
use futures_bounded::{Delay, FuturesSet};
1414
use libp2p_core::{
1515
upgrade::{DeniedUpgrade, ReadyUpgrade},
1616
Multiaddr,
@@ -64,7 +64,7 @@ where
6464
observed_multiaddr,
6565
dial_back_cmd_sender,
6666
dial_back_cmd_receiver,
67-
inbound: FuturesSet::new(Duration::from_secs(10), 10),
67+
inbound: FuturesSet::new(|| Delay::futures_timer(Duration::from_secs(10)), 10),
6868
rng,
6969
}
7070
}

protocols/dcutr/src/handler/relayed.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use std::{
2929

3030
use either::Either;
3131
use futures::future;
32+
use futures_bounded::Delay;
3233
use libp2p_core::{
3334
multiaddr::Multiaddr,
3435
upgrade::{DeniedUpgrade, ReadyUpgrade},
@@ -87,8 +88,14 @@ impl Handler {
8788
Self {
8889
endpoint,
8990
queued_events: Default::default(),
90-
inbound_stream: futures_bounded::FuturesSet::new(Duration::from_secs(10), 1),
91-
outbound_stream: futures_bounded::FuturesSet::new(Duration::from_secs(10), 1),
91+
inbound_stream: futures_bounded::FuturesSet::new(
92+
|| Delay::futures_timer(Duration::from_secs(10)),
93+
1,
94+
),
95+
outbound_stream: futures_bounded::FuturesSet::new(
96+
|| Delay::futures_timer(Duration::from_secs(10)),
97+
1,
98+
),
9299
holepunch_candidates,
93100
attempts: 0,
94101
}

protocols/identify/src/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl Handler {
139139
remote_peer_id,
140140
events: SmallVec::new(),
141141
active_streams: futures_bounded::FuturesSet::new(
142-
STREAM_TIMEOUT,
142+
|| futures_bounded::Delay::futures_timer(STREAM_TIMEOUT),
143143
MAX_CONCURRENT_STREAMS_PER_CONNECTION,
144144
),
145145
trigger_next_identify: Delay::new(Duration::ZERO),

protocols/kad/src/handler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use std::{
2828

2929
use either::Either;
3030
use futures::{channel::oneshot, prelude::*, stream::SelectAll};
31+
use futures_bounded::Delay;
3132
use libp2p_core::{upgrade, ConnectedPoint};
3233
use libp2p_identity::PeerId;
3334
use libp2p_swarm::{
@@ -463,7 +464,7 @@ impl Handler {
463464
next_connec_unique_id: UniqueConnecId(0),
464465
inbound_substreams: Default::default(),
465466
outbound_substreams: futures_bounded::FuturesTupleSet::new(
466-
substreams_timeout,
467+
move || Delay::futures_timer(substreams_timeout),
467468
MAX_NUM_STREAMS,
468469
),
469470
pending_streams: Default::default(),

protocols/perf/src/server/handler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::{
2424
};
2525

2626
use futures::FutureExt;
27+
use futures_bounded::Delay;
2728
use libp2p_core::upgrade::{DeniedUpgrade, ReadyUpgrade};
2829
use libp2p_swarm::{
2930
handler::{
@@ -49,7 +50,7 @@ impl Handler {
4950
pub fn new() -> Self {
5051
Self {
5152
inbound: futures_bounded::FuturesSet::new(
52-
crate::RUN_TIMEOUT,
53+
|| Delay::futures_timer(crate::RUN_TIMEOUT),
5354
crate::MAX_PARALLEL_RUNS_PER_CONNECTION,
5455
),
5556
}

0 commit comments

Comments
 (0)