mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 08:51:08 +03:00
Introduce a constant for peer send channel capacity (#1761)
We implicitly use it also in body_sync, so it's hard to keep it in sync.
This commit is contained in:
parent
8540e4f723
commit
85433c659d
3 changed files with 5 additions and 2 deletions
|
@ -141,6 +141,8 @@ impl<'a> Response<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub const SEND_CHANNEL_CAP: usize = 10;
|
||||
|
||||
// TODO count sent and received
|
||||
pub struct Tracker {
|
||||
/// Bytes we've sent.
|
||||
|
@ -173,7 +175,7 @@ pub fn listen<H>(stream: TcpStream, handler: H) -> Tracker
|
|||
where
|
||||
H: MessageHandler,
|
||||
{
|
||||
let (send_tx, send_rx) = mpsc::sync_channel(10);
|
||||
let (send_tx, send_rx) = mpsc::sync_channel(SEND_CHANNEL_CAP);
|
||||
let (close_tx, close_rx) = mpsc::channel();
|
||||
let (error_tx, error_rx) = mpsc::channel();
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ mod serv;
|
|||
mod store;
|
||||
pub mod types;
|
||||
|
||||
pub use conn::SEND_CHANNEL_CAP;
|
||||
pub use peer::Peer;
|
||||
pub use peers::Peers;
|
||||
pub use serv::{DummyAdapter, Server};
|
||||
|
|
|
@ -133,7 +133,7 @@ impl BodySync {
|
|||
};
|
||||
|
||||
let block_count = cmp::min(
|
||||
cmp::min(100, peers.len() * 10),
|
||||
cmp::min(100, peers.len() * p2p::SEND_CHANNEL_CAP),
|
||||
chain::MAX_ORPHAN_SIZE.saturating_sub(self.chain.orphans_len()) + 1,
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue