Enable gVisor tcp_socket_test

This commit is contained in:
jiangjianfeng
2025-01-23 03:10:09 +00:00
committed by Tate, Hongliang Tian
parent 3e31df74e3
commit 3f951e0c0c
11 changed files with 260 additions and 49 deletions

View File

@ -453,13 +453,22 @@ impl<E: Ext> TcpConnection<E> {
/// Closes the connection.
///
/// This method returns `false` if the socket is closed _before_ calling this method.
///
/// Polling the iface is _always_ required after this method succeeds.
pub fn close(&self) {
pub fn close(&self) -> bool {
let mut socket = self.0.inner.lock();
socket.listener = None;
if socket.is_closed() {
return false;
}
socket.close();
self.0.update_next_poll_at_ms(PollAt::Now);
true
}
/// Calls `f` with an immutable reference to the associated [`RawTcpSocket`].