File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 16
16
See [ PR 5774] ( https://github.com/libp2p/rust-libp2p/pull/5774 ) .
17
17
- Add lazy cleanup for expired provider records in ` Behavior::get_providers ` and ` Behavior::provider_peers ` .
18
18
See [ PR 5980] ( https://github.com/libp2p/rust-libp2p/pull/5980 )
19
+ - Configurable OUTBOUND_SUBSTREAMS_TIMEOUT.
20
+ See [ PR 6015] ( https://github.com/libp2p/rust-libp2p/pull/6015 ) .
19
21
20
22
<!-- Update to libp2p-core v0.43.0 -->
21
23
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use std::{
23
23
error, fmt, io,
24
24
marker:: PhantomData ,
25
25
pin:: Pin ,
26
+ sync:: LazyLock ,
26
27
task:: { Context , Poll , Waker } ,
27
28
time:: Duration ,
28
29
} ;
@@ -48,6 +49,16 @@ use crate::{
48
49
49
50
const MAX_NUM_STREAMS : usize = 32 ;
50
51
52
+ /// Specifies the outbound_substreams timeout.
53
+ ///
54
+ /// Can be overridden by the `OUTBOUND_STREAMS_TIMEOUT` environment variable.
55
+ static OUTBOUND_STREAMS_TIMEOUT : LazyLock < u64 > = LazyLock :: new ( || {
56
+ std:: env:: var ( "OUTBOUND_STREAMS_TIMEOUT" )
57
+ . ok ( )
58
+ . and_then ( |s| s. parse ( ) . ok ( ) )
59
+ . unwrap_or ( 10 )
60
+ } ) ;
61
+
51
62
/// Protocol handler that manages substreams for the Kademlia protocol
52
63
/// on a single connection with a peer.
53
64
///
@@ -462,7 +473,7 @@ impl Handler {
462
473
next_connec_unique_id : UniqueConnecId ( 0 ) ,
463
474
inbound_substreams : Default :: default ( ) ,
464
475
outbound_substreams : futures_bounded:: FuturesTupleSet :: new (
465
- Duration :: from_secs ( 10 ) ,
476
+ Duration :: from_secs ( * OUTBOUND_STREAMS_TIMEOUT ) ,
466
477
MAX_NUM_STREAMS ,
467
478
) ,
468
479
pending_streams : Default :: default ( ) ,
You can’t perform that action at this time.
0 commit comments