@@ -49,6 +49,8 @@ use crate::{
49
49
pub ( crate ) const DEFAULT_PROTO_NAME : StreamProtocol = StreamProtocol :: new ( "/ipfs/kad/1.0.0" ) ;
50
50
/// The default maximum size for a varint length-delimited packet.
51
51
pub ( crate ) const DEFAULT_MAX_PACKET_SIZE : usize = 16 * 1024 ;
52
+ /// The default timeout of outbound_substreams to be 10 (seconds).
53
+ const DEFAULT_OUTBOUND_SUBSTREAMS_TIMEOUT_S : u64 = 10 ;
52
54
/// Status of our connection to a node reported by the Kademlia protocol.
53
55
#[ derive( Copy , Clone , PartialEq , Eq , Debug , Hash ) ]
54
56
pub enum ConnectionType {
@@ -145,6 +147,8 @@ pub struct ProtocolConfig {
145
147
protocol_names : Vec < StreamProtocol > ,
146
148
/// Maximum allowed size of a packet.
147
149
max_packet_size : usize ,
150
+ /// Specifies the outbound_substreams timeout in seconds
151
+ outbound_substreams_timeout_s : u64 ,
148
152
}
149
153
150
154
impl ProtocolConfig {
@@ -153,6 +157,7 @@ impl ProtocolConfig {
153
157
ProtocolConfig {
154
158
protocol_names : vec ! [ protocol_name] ,
155
159
max_packet_size : DEFAULT_MAX_PACKET_SIZE ,
160
+ outbound_substreams_timeout_s : DEFAULT_OUTBOUND_SUBSTREAMS_TIMEOUT_S ,
156
161
}
157
162
}
158
163
@@ -165,6 +170,16 @@ impl ProtocolConfig {
165
170
pub fn set_max_packet_size ( & mut self , size : usize ) {
166
171
self . max_packet_size = size;
167
172
}
173
+
174
+ /// Modifies outbount_substreams timeout.
175
+ pub fn set_outbound_substreams_timeout ( & mut self , value : u64 ) {
176
+ self . outbound_substreams_timeout_s = value;
177
+ }
178
+
179
+ /// Getter of outbount_substreams_timeout_s.
180
+ pub fn outbound_substreams_timeout_s ( & self ) -> u64 {
181
+ self . outbound_substreams_timeout_s
182
+ }
168
183
}
169
184
170
185
impl UpgradeInfo for ProtocolConfig {
0 commit comments