Limit incoming size to 1 in tests to more easily simulate backpressure
This commit is contained in:
parent
3844634765
commit
c06e5f3d1e
1 changed files with 5 additions and 1 deletions
|
@ -126,7 +126,11 @@ impl Peer {
|
||||||
// can always send messages without yielding. For incoming messages, use a
|
// can always send messages without yielding. For incoming messages, use a
|
||||||
// bounded channel so that other peers will receive backpressure if they send
|
// bounded channel so that other peers will receive backpressure if they send
|
||||||
// messages faster than this peer can process them.
|
// messages faster than this peer can process them.
|
||||||
let (mut incoming_tx, incoming_rx) = mpsc::channel(64);
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
|
const INCOMING_BUFFER_SIZE: usize = 1;
|
||||||
|
#[cfg(not(any(test, feature = "test-support")))]
|
||||||
|
const INCOMING_BUFFER_SIZE: usize = 64;
|
||||||
|
let (mut incoming_tx, incoming_rx) = mpsc::channel(INCOMING_BUFFER_SIZE);
|
||||||
let (outgoing_tx, mut outgoing_rx) = mpsc::unbounded();
|
let (outgoing_tx, mut outgoing_rx) = mpsc::unbounded();
|
||||||
|
|
||||||
let connection_id = ConnectionId(self.next_connection_id.fetch_add(1, SeqCst));
|
let connection_id = ConnectionId(self.next_connection_id.fetch_add(1, SeqCst));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue