Skip to content

Commit 624a60a

Browse files
committed
channel connection timeout for request-response
1 parent 1da7ffe commit 624a60a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

p2p/src/behaviour.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ fn create_request_response_behaviour(
5454
protocol_name: StreamProtocol,
5555
) -> request_response::cbor::Behaviour<Vec<u8>, Vec<u8>> {
5656
use request_response::{Behaviour, Config, ProtocolSupport};
57+
const REQUEST_RESPONSE_TIMEOUT: u64 = 180;
5758

58-
Behaviour::new([(protocol_name, ProtocolSupport::Full)], Config::default())
59+
Behaviour::new([(protocol_name, ProtocolSupport::Full)],
60+
Config::default().with_request_timeout(Duration::from_secs(REQUEST_RESPONSE_TIMEOUT)))
5961
}
6062

6163
/// Configures the connection limits.

0 commit comments

Comments
 (0)