netlink-request: don't include Done and Ack messages in response

pull/186/head
Jake McGinty 2022-01-12 15:56:56 -06:00
parent b15b541669
commit fa24aedd1f
1 changed files with 1 additions and 1 deletions

View File

@ -121,13 +121,13 @@ mod linux {
let bytes = &buf[offset..];
let response = NetlinkMessage::<I>::deserialize(bytes)
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
responses.push(response.clone());
match response.payload {
// We've parsed all parts of the response and can leave the loop.
NetlinkPayload::Ack(_) | NetlinkPayload::Done => return Ok(responses),
NetlinkPayload::Error(e) => return Err(e.into()),
_ => {},
}
responses.push(response.clone());
offset += response.header.length as usize;
if offset == n_received || response.header.length == 0 {
// We've fully parsed the datagram, but there may be further datagrams