Skip to content

Commit

Permalink
Fix Priority usage in TransmissionPipeline API
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Dec 4, 2024
1 parent 5b24ff5 commit 7e66014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions io/zenoh-transport/src/common/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,13 +815,14 @@ pub(crate) struct TransmissionPipelineConsumer {
}

impl TransmissionPipelineConsumer {
pub(crate) async fn pull(&mut self) -> Option<(WBatch, usize)> {
pub(crate) async fn pull(&mut self) -> Option<(WBatch, Priority)> {
while !self.status.is_disabled() {
let mut backoff = MicroSeconds::MAX;
// Calculate the backoff maximum
for (prio, queue) in self.stage_out.iter_mut().enumerate() {
match queue.try_pull() {
Pull::Some(batch) => {
let prio = Priority::try_from(prio as u8).unwrap();
return Some((batch, prio));
}
Pull::Backoff(deadline) => {
Expand Down Expand Up @@ -861,8 +862,8 @@ impl TransmissionPipelineConsumer {
None
}

pub(crate) fn refill(&mut self, batch: WBatch, priority: usize) {
self.stage_out[priority].refill(batch);
pub(crate) fn refill(&mut self, batch: WBatch, priority: Priority) {
self.stage_out[priority as usize].refill(batch);
self.status.set_congested(priority, false);
}

Expand Down
4 changes: 2 additions & 2 deletions io/zenoh-transport/src/multicast/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ async fn tx_task(
link.send_batch(&mut batch).await?;
// Keep track of next SNs
if let Some(sn) = batch.codec.latest_sn.reliable {
last_sns[priority].reliable = sn;
last_sns[priority as usize].reliable = sn;
}
if let Some(sn) = batch.codec.latest_sn.best_effort {
last_sns[priority].best_effort = sn;
last_sns[priority as usize].best_effort = sn;
}
#[cfg(feature = "stats")]
{
Expand Down

0 comments on commit 7e66014

Please sign in to comment.