Skip to content

Commit

Permalink
Limited outgoing messages on buffer to 1 per poll_send_messages call
Browse files Browse the repository at this point in the history
  • Loading branch information
najaco committed Aug 17, 2023
1 parent 897d92d commit ce4f57f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,23 @@ where
} = self;
let mut socket = Pin::new(socket);

while !protocol.outgoing_messages.is_empty() {
if !protocol.outgoing_messages.is_empty() {
trace!(
"found outgoing message to send checking if socket is ready"
);
if let Poll::Ready(Err(e)) = Pin::as_mut(&mut socket).poll_ready(cx)
{
// Sink errors are usually not recoverable. The socket
// probably shut down.
warn!("netlink socket shut down: {:?}", e);
self.socket_closed = true;
return;
match Pin::as_mut(&mut socket).poll_ready(cx) {
Poll::Ready(Err(e)) => {
// Sink errors are usually not recoverable. The socket
// probably shut down.
warn!("netlink socket shut down: {:?}", e);
self.socket_closed = true;
return;
}
Poll::Pending => {
trace!("poll is not ready, returning");
return;
}
Poll::Ready(Ok(_)) => {}
}

let (mut message, addr) =
Expand Down

0 comments on commit ce4f57f

Please sign in to comment.