mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 22:17:19 +00:00
dragonball: fix EPOLLHUP/EPOLLERR events handling in vsock
1. EPOLLHUP events also need to be read and will be got len 0. 2. We should kill the connection when EPOLLERR events are received. Signed-off-by: Tim Zhang <tim@hyper.sh> Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
This commit is contained in:
parent
7b11fd2546
commit
221c5b51fe
@ -460,7 +460,8 @@ impl VsockEpollListener for VsockConnection {
|
||||
/// Notify the connection about an event (or set of events) that it was
|
||||
/// interested in.
|
||||
fn notify(&mut self, evset: epoll::Events) {
|
||||
if evset.contains(epoll::Events::EPOLLIN) {
|
||||
// EPOLLHUP also needs to be read and will be got len 0
|
||||
if evset.contains(epoll::Events::EPOLLIN) || evset.contains(epoll::Events::EPOLLHUP) {
|
||||
// Data can be read from the host stream. Setting a Rw pending
|
||||
// indication, so that the muxer will know to call `recv_pkt()`
|
||||
// later.
|
||||
@ -514,6 +515,19 @@ impl VsockEpollListener for VsockConnection {
|
||||
self.pending_rx.insert(PendingRx::CreditUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
// The host stream has encountered an error. We'll kill this
|
||||
// connection.
|
||||
if evset.contains(epoll::Events::EPOLLERR)
|
||||
&& !evset.contains(epoll::Events::EPOLLIN)
|
||||
&& !evset.contains(epoll::Events::EPOLLOUT)
|
||||
{
|
||||
warn!(
|
||||
"vsock: connection received EPOLLERR event: lp={}, pp={}",
|
||||
self.local_port, self.peer_port
|
||||
);
|
||||
self.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user