mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-23 06:05:21 +00:00
vhost_rs: vhost_user: Return error when connection broken
Return an error wen recvmsg() returns without a message using the libc::ECONNRESET error so that the upper levels will correctly interpret this as the connection being broken. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
c49e31a6d9
commit
b5755e9c33
@ -182,8 +182,9 @@ fn raw_recvmsg(fd: RawFd, iovecs: &mut [iovec], in_fds: &mut [RawFd]) -> Result<
|
||||
return Err(Error::last());
|
||||
}
|
||||
|
||||
// When the connection is closed recvmsg() doesn't give an explicit error
|
||||
if total_read == 0 && msg.msg_controllen < size_of::<cmsghdr>() {
|
||||
return Ok((0, 0));
|
||||
return Err(Error::new(libc::ECONNRESET));
|
||||
}
|
||||
|
||||
let mut cmsg_ptr = msg.msg_control as *mut cmsghdr;
|
||||
|
Loading…
Reference in New Issue
Block a user