mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-19 15:58:25 +00:00
dragonball: vsock: properly handle EPOLLHUP/EPOLLERR events
When one end of the connection close, the epoll event will be triggered forever. We should close the connection and kill the connection. Fixes: #6714 Signed-off-by: Zixuan Tan <tanzixuan.me@gmail.com>
This commit is contained in:
@@ -487,6 +487,31 @@ impl VsockEpollListener for VsockConnection {
|
|||||||
self.pending_rx.insert(PendingRx::CreditUpdate);
|
self.pending_rx.insert(PendingRx::CreditUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if evset.contains(epoll::Events::EPOLLHUP)
|
||||||
|
&& !evset.contains(epoll::Events::EPOLLIN)
|
||||||
|
&& !evset.contains(epoll::Events::EPOLLOUT)
|
||||||
|
{
|
||||||
|
// The host stream has been hung up. We'll kill this connection.
|
||||||
|
warn!(
|
||||||
|
"vsock: connection received EPOLLHUP event: lp={}, pp={}",
|
||||||
|
self.local_port, self.peer_port
|
||||||
|
);
|
||||||
|
self.kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
if evset.contains(epoll::Events::EPOLLERR)
|
||||||
|
&& !evset.contains(epoll::Events::EPOLLIN)
|
||||||
|
&& !evset.contains(epoll::Events::EPOLLOUT)
|
||||||
|
{
|
||||||
|
// The host stream has encountered an error. We'll kill this
|
||||||
|
// connection.
|
||||||
|
warn!(
|
||||||
|
"vsock: connection received EPOLLERR event: lp={}, pp={}",
|
||||||
|
self.local_port, self.peer_port
|
||||||
|
);
|
||||||
|
self.kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user