Skip to content

Commit

Permalink
add constant for queue buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Dec 21, 2023
1 parent 4a95baf commit 4ed2a20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pallas-network/src/multiplexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ type Egress = (
tokio::sync::broadcast::Receiver<(Protocol, Payload)>,
);

const EGRESS_MSG_QUEUE_BUFFER: usize = 100_000;

pub struct Demuxer(BearerReadHalf, Egress);

impl Demuxer {
pub fn new(bearer: BearerReadHalf) -> Self {
let egress = tokio::sync::broadcast::channel(10_000);
let egress = tokio::sync::broadcast::channel(EGRESS_MSG_QUEUE_BUFFER);
Self(bearer, egress)
}

Expand Down Expand Up @@ -285,11 +287,13 @@ type Ingress = (

type Clock = Instant;

const INGRESS_MSG_QUEUE_BUFFER: usize = 100;

pub struct Muxer(BearerWriteHalf, Clock, Ingress);

impl Muxer {
pub fn new(bearer: BearerWriteHalf) -> Self {
let ingress = tokio::sync::mpsc::channel(100); // TODO: define buffer
let ingress = tokio::sync::mpsc::channel(INGRESS_MSG_QUEUE_BUFFER);
let clock = Instant::now();
Self(bearer, clock, ingress)
}
Expand Down

0 comments on commit 4ed2a20

Please sign in to comment.