Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Refactor base types #195

Merged
merged 11 commits into from
Nov 17, 2021
10 changes: 2 additions & 8 deletions netlink-packet-audit/src/rules/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,8 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<RuleBuffer<&'a T>> for RuleMessage {

let mut offset = 0;

let fields = buf
.fields()
.chunks(4)
.map(|chunk| NativeEndian::read_u32(chunk));
let values = buf
.values()
.chunks(4)
.map(|chunk| NativeEndian::read_u32(chunk));
let fields = buf.fields().chunks(4).map(NativeEndian::read_u32);
let values = buf.values().chunks(4).map(NativeEndian::read_u32);
let field_flags = buf
.field_flags()
.chunks(4)
Expand Down
3 changes: 1 addition & 2 deletions netlink-proto/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ impl<C: Encoder<Item> + Unpin, Item> Sink<(Item, SocketAddr)> for NetlinkFramed<
Err(io::Error::new(
io::ErrorKind::Other,
"failed to write entire datagram to socket",
)
.into())
))
};

Poll::Ready(res)
Expand Down
10 changes: 5 additions & 5 deletions netlink-sys/src/smol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ impl SmolSocket {
trace!("poll_recv_from socket is ready for reading");

match self.0.get_ref().recv_from(buf, 0) {
Ok(x) => {
trace!("poll_recv_from {:?} bytes read", x);
return Poll::Ready(Ok(x));
}
Err(_would_block) => {
Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
little-dude marked this conversation as resolved.
Show resolved Hide resolved
trace!("poll_recv_from socket would block");
continue;
}
x => {
trace!("poll_recv_from {:?} bytes read", x);
return Poll::Ready(x);
}
}
}
}
Expand Down