Skip to content

Commit f4cbd15

Browse files
Nathan Cohencathay4t
authored andcommitted
Limited outgoing messages on buffer to 1 per poll_send_messages call
1 parent aafea32 commit f4cbd15

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/connection.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,23 @@ where
8989
} = self;
9090
let mut socket = Pin::new(socket);
9191

92-
while !protocol.outgoing_messages.is_empty() {
92+
if !protocol.outgoing_messages.is_empty() {
9393
trace!(
9494
"found outgoing message to send checking if socket is ready"
9595
);
96-
if let Poll::Ready(Err(e)) = Pin::as_mut(&mut socket).poll_ready(cx)
97-
{
98-
// Sink errors are usually not recoverable. The socket
99-
// probably shut down.
100-
warn!("netlink socket shut down: {:?}", e);
101-
self.socket_closed = true;
102-
return;
96+
match Pin::as_mut(&mut socket).poll_ready(cx) {
97+
Poll::Ready(Err(e)) => {
98+
// Sink errors are usually not recoverable. The socket
99+
// probably shut down.
100+
warn!("netlink socket shut down: {:?}", e);
101+
self.socket_closed = true;
102+
return;
103+
}
104+
Poll::Pending => {
105+
trace!("poll is not ready, returning");
106+
return;
107+
}
108+
Poll::Ready(Ok(_)) => {}
103109
}
104110

105111
let (mut message, addr) =

0 commit comments

Comments
 (0)