Skip to content

Commit

Permalink
Increase peer's send buffer (#2931) (#2934)
Browse files Browse the repository at this point in the history
When we send a txhashet archive a peer's thread is busy with sending it
and can't send other messages, eg pings. If the network connection is
slow buffer capacity 10 may be not enough,  hence the peer's drop.

Safer attempt to address #2929 in 2.0.0
  • Loading branch information
hashmap authored Jun 30, 2019
1 parent 2f01274 commit dbd2535
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion p2p/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a> Response<'a> {
}
}

pub const SEND_CHANNEL_CAP: usize = 10;
pub const SEND_CHANNEL_CAP: usize = 100;

pub struct StopHandle {
/// Channel to close the connection
Expand Down
2 changes: 1 addition & 1 deletion servers/src/grin/sync/body_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl BodySync {
// 10) max will be 80 if all 8 peers are advertising more work
// also if the chain is already saturated with orphans, throttle
let block_count = cmp::min(
cmp::min(100, peers.len() * p2p::SEND_CHANNEL_CAP),
cmp::min(100, peers.len() * 10),
chain::MAX_ORPHAN_SIZE.saturating_sub(self.chain.orphans_len()) + 1,
);

Expand Down

0 comments on commit dbd2535

Please sign in to comment.