Skip to content

Commit

Permalink
remove a unnecessary read timeout... at least I suppose
Browse files Browse the repository at this point in the history
  • Loading branch information
XdoctorwhoZ committed Dec 20, 2024
1 parent c58ce14 commit a332be3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 19 additions & 1 deletion rumqttd/src/link/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use tokio::{
io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
time::timeout,
};
use tracing::debug;

use std::{
collections::VecDeque,
Expand Down Expand Up @@ -103,7 +104,24 @@ impl<P: Protocol> Network<P> {

// read more packets until a frame can be created. This function
// blocks until a frame can be created. Use this in a select! branch
timeout(self.keepalive, self.read_bytes(required)).await??;
let rt1 = timeout(self.keepalive, self.read_bytes(required)).await;
match rt1 {
Ok(rt2) => {
match rt2 {
Ok(_) => {

}
Err(e) => {
debug!("network read / direct error {:?}", e);
return Err(Error::Io(e));
}
}
},
Err(e) => {
debug!("network read / elasped {:?}", e);
}
}

}
}

Expand Down
4 changes: 2 additions & 2 deletions rumqttd/src/router/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ fn ack_device_data(ackslog: &mut AckLog, outgoing: &mut Outgoing) -> bool {

let acks = ackslog.readv();
if acks.is_empty() {
debug!("No acks pending");
trace!("No acks pending");
return false;
}

Expand All @@ -1389,7 +1389,7 @@ fn ack_device_data(ackslog: &mut AckLog, outgoing: &mut Outgoing) -> bool {
count += 1;
}

debug!(acks_count = count, "Acks sent to device");
trace!(acks_count = count, "Acks sent to device");
outgoing.handle.try_send(()).ok();
true
}
Expand Down

0 comments on commit a332be3

Please sign in to comment.