Skip to content

Commit

Permalink
Ignore socket failure to close during del
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Tindall committed Aug 22, 2022
1 parent 0757622 commit 0a6f166
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mcstatus/protocol/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,10 @@ def close(self) -> None:

def __del__(self) -> None:
"""Close self.socket."""
self.close()
try:
self.close()
except OSError: # Probably, the socket was already closed by the OS
pass


class TCPSocketConnection(SocketConnection):
Expand Down

0 comments on commit 0a6f166

Please sign in to comment.