fix concurrent socket close (#6612)

This commit is contained in:
Jeong, YunWon authored and GitHub committed 2025-12-31 17:52:24 +09:00
1 parent b3b97cac7c
commit d3afd465f3
1 file changed
+3 -3
+3 -3
View File
@@ -2107,9 +2107,9 @@ mod _socket {
#[pymethod]
fn close(&self) -> io::Result<()> {
let sock = self.detach();
if sock != INVALID_SOCKET as i64 {
close_inner(sock as RawSocket)?;
let sock = self.sock.write().take();
if let Some(sock) = sock {
close_inner(into_sock_fileno(sock))?;
}
Ok(())
}