vm-virtio: Add error propagation for TAP listener (un)registration

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-05-29 14:30:04 +01:00 committed by Sebastien Boeuf
parent 3151b5d82a
commit 36d072e69c
2 changed files with 4 additions and 2 deletions

View File

@ -180,6 +180,8 @@ pub enum Error {
event: DeviceEventT,
},
IoError(io::Error),
RegisterListener(io::Error),
UnregisterListener(io::Error),
EpollCreateFd(io::Error),
EpollCtl(io::Error),
EpollWait(io::Error),

View File

@ -84,7 +84,7 @@ impl NetEpollHandler {
epoll::Events::EPOLLIN,
u64::from(RX_TAP_EVENT),
)
.unwrap();
.map_err(DeviceError::UnregisterListener)?;
self.rx_tap_listening = false;
}
return false;
@ -134,7 +134,7 @@ impl NetEpollHandler {
epoll::Events::EPOLLIN,
u64::from(RX_TAP_EVENT),
)
.unwrap();
.map_err(DeviceError::RegisterListener)?;
self.rx_tap_listening = true;
}
if self.rx.deferred_frame {