Skip to content

Commit

Permalink
Merge pull request #1482 from microsoft/ab-correct-timers
Browse files Browse the repository at this point in the history
[inetstack] Enhancement: correct timer statements
  • Loading branch information
anandbonde authored Jan 6, 2025
2 parents 47256e8 + 3795c32 commit 0e2188f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/rust/inetstack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ use ::std::{
ops::{Deref, DerefMut},
};

use crate::timer;

//======================================================================================================================
// Exports
//======================================================================================================================
Expand Down Expand Up @@ -278,8 +276,6 @@ impl NetworkTransport for SharedInetStack {
buf: &mut DemiBuffer,
addr: Option<SocketAddr>,
) -> Result<(), Fail> {
timer!("inetstack::push");

self.layer4_endpoint.push(sd, buf, addr).await
}

Expand Down
16 changes: 8 additions & 8 deletions src/rust/inetstack/protocols/layer4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ impl Peer {
}

pub fn poll_once(&mut self) {
match {
timer!("inetstack::layer4_endpoint::poll_once");

self.layer3_endpoint.receive()
} {
Ok(batch) if !batch.is_empty() => self.receive_batch(batch),
Ok(_) => (),
timer!("inetstack::layer4::poll_once");
match self.layer3_endpoint.receive() {
Ok(batch) => {
if !batch.is_empty() {
self.receive_batch(batch)
}
},
Err(_) => warn!("Could not receive from network interface, continuing ..."),
}
}

fn receive_batch(&mut self, batch: ArrayVec<(Ipv4Addr, IpProtocol, DemiBuffer), RECEIVE_BATCH_SIZE>) {
timer!("inetstack::poll_bg_work::for::for");
timer!("inetstack::layer4::receive_batch");
trace!("found packets: {:?}", batch.len());
for (src_ipv4_addr, ip_type, payload) in batch {
match ip_type {
Expand Down

0 comments on commit 0e2188f

Please sign in to comment.