Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
/// message, the stream is
/// closed
pub fn request(
&mut self,
&self,
message: NetlinkMessage<T>,
destination: SocketAddr,
) -> Result<impl Stream<Item = NetlinkMessage<T>>, Error<T>> {
Expand All @@ -59,7 +59,7 @@ where
}

pub fn notify(
&mut self,
&self,
message: NetlinkMessage<T>,
destination: SocketAddr,
) -> Result<(), Error<T>> {
Expand Down