mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 01:47:55 +00:00
Fix crash when --in-peers & --out-peers both 0 (#14598)
This commit is contained in:
@@ -153,7 +153,8 @@ where
|
||||
) -> (Self, ProtocolConfig) {
|
||||
// Reserve enough request slots for one request per peer when we are at the maximum
|
||||
// number of peers.
|
||||
let (tx, request_receiver) = async_channel::bounded(num_peer_hint);
|
||||
let capacity = std::cmp::max(num_peer_hint, 1);
|
||||
let (tx, request_receiver) = async_channel::bounded(capacity);
|
||||
|
||||
let mut protocol_config = generate_protocol_config(
|
||||
protocol_id,
|
||||
|
||||
@@ -131,7 +131,8 @@ where
|
||||
) -> (Self, ProtocolConfig) {
|
||||
// Reserve enough request slots for one request per peer when we are at the maximum
|
||||
// number of peers.
|
||||
let (tx, request_receiver) = async_channel::bounded(num_peer_hint);
|
||||
let capacity = std::cmp::max(num_peer_hint, 1);
|
||||
let (tx, request_receiver) = async_channel::bounded(capacity);
|
||||
|
||||
let mut protocol_config = generate_protocol_config(
|
||||
protocol_id,
|
||||
|
||||
Reference in New Issue
Block a user