Skip to content

Commit b202f70

Browse files
committed
fix type
1 parent fe02b6f commit b202f70

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/test_trustme.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ def safe_close(sock: Optional[Union[socket.socket, SslSocket]]) -> None:
288288
if sock is None:
289289
return
290290
try:
291-
sock.shutdown(socket.SHUT_RDWR)
291+
if isinstance(sock, (socket.socket, ssl.SSLSocket)):
292+
sock.shutdown(socket.SHUT_RDWR)
293+
elif isinstance(sock, OpenSSL.SSL.Connection):
294+
sock.shutdown()
292295
except Exception:
293296
pass
294297
try:

0 commit comments

Comments
 (0)