vm-virtio: vhost_user: net: On shutdown() drop the socket

This causes the vhost-user-net backend to shutdown.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-02-14 10:08:59 +00:00
parent 7c9e8b103f
commit 503887843f

View File

@ -17,6 +17,7 @@ use libc::EFD_NONBLOCK;
use net_util::MacAddr;
use std::cmp;
use std::io::Write;
use std::os::unix::io::AsRawFd;
use std::result;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
@ -354,6 +355,10 @@ impl VirtioDevice for Net {
self.queue_evts.take().unwrap(),
))
}
fn shutdown(&mut self) {
let _ = unsafe { libc::close(self.vhost_user_net.as_raw_fd()) };
}
}
virtio_ctrl_q_pausable!(Net);