Skip to content

Commit d3afd46

Browse files
authored
fix concurrent socket close (#6612)
1 parent b3b97ca commit d3afd46

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/stdlib/src/socket.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,9 +2107,9 @@ mod _socket {
21072107

21082108
#[pymethod]
21092109
fn close(&self) -> io::Result<()> {
2110-
let sock = self.detach();
2111-
if sock != INVALID_SOCKET as i64 {
2112-
close_inner(sock as RawSocket)?;
2110+
let sock = self.sock.write().take();
2111+
if let Some(sock) = sock {
2112+
close_inner(into_sock_fileno(sock))?;
21132113
}
21142114
Ok(())
21152115
}

0 commit comments

Comments
 (0)