vhost-user-backend: Correct error handling in run

The error handling here to trigger break epoll seems not correct,
epoll will be ended once one event is handled, no matter successfully
or failed. Fix it.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
Cathy Zhang
2019-09-24 15:27:01 +08:00
committed by Sebastien Boeuf
parent c4309515c9
commit 4a1af7f63c
+5 -9
View File
@@ -40,8 +40,6 @@ pub enum Error {
WaitDaemon(std::boxed::Box<dyn std::any::Any + std::marker::Send>), WaitDaemon(std::boxed::Box<dyn std::any::Any + std::marker::Send>),
/// Failed handling a vhost-user request. /// Failed handling a vhost-user request.
HandleRequest(VhostUserError), HandleRequest(VhostUserError),
/// Failed to handle the event.
HandleEvent(io::Error),
/// Failed to process queue. /// Failed to process queue.
ProcessQueue(VringEpollHandlerError), ProcessQueue(VringEpollHandlerError),
/// Failed to register listener. /// Failed to register listener.
@@ -439,13 +437,11 @@ impl<S: VhostUserBackend> VringWorker<S> {
let ev_type = event.data as u16; let ev_type = event.data as u16;
if self if let Err(e) = self.handler.write().unwrap().handle_event(ev_type, evset) {
.handler println!(
.write() "vring handler handle event {} with error {:?}\n",
.unwrap() ev_type, e
.handle_event(ev_type, evset) );
.map_err(VringWorkerError::HandleEvent)?
{
break 'epoll; break 'epoll;
} }
} }