Skip to content

Commit ad0b9c4

Browse files
committed
Fix #195, don't log ssl.CertificateError
1 parent 8d5a9a3 commit ad0b9c4

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

uvloop/handles/basetransport.pyx

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ cdef class UVBaseTransport(UVSocketHandle):
4040

4141
self._force_close(exc)
4242

43-
if not isinstance(exc, (BrokenPipeError,
44-
ConnectionResetError,
45-
ConnectionAbortedError)):
43+
if not isinstance(exc, FATAL_SSL_ERROR_IGNORE):
4644

4745
if throw or self._loop is None:
4846
raise exc

uvloop/handles/streamserver.pyx

+1-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ cdef class UVStreamServer(UVSocketHandle):
8989

9090
self._close()
9191

92-
if not isinstance(exc, (BrokenPipeError,
93-
ConnectionResetError,
94-
ConnectionAbortedError)):
92+
if not isinstance(exc, FATAL_SSL_ERROR_IGNORE):
9593

9694
if throw or self._loop is None:
9795
raise exc

uvloop/includes/stdlib.pxi

+7
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ cdef int ssl_SSL_ERROR_WANT_READ = ssl.SSL_ERROR_WANT_READ
126126
cdef int ssl_SSL_ERROR_WANT_WRITE = ssl.SSL_ERROR_WANT_WRITE
127127
cdef int ssl_SSL_ERROR_SYSCALL = ssl.SSL_ERROR_SYSCALL
128128

129+
cdef FATAL_SSL_ERROR_IGNORE = (
130+
BrokenPipeError,
131+
ConnectionResetError,
132+
ConnectionAbortedError,
133+
ssl.CertificateError,
134+
)
135+
129136
cdef uint64_t MAIN_THREAD_ID = <uint64_t><int64_t>threading.main_thread().ident
130137

131138
cdef int subprocess_PIPE = subprocess.PIPE

uvloop/sslproto.pyx

+1-3
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,7 @@ cdef class SSLProtocol:
829829
if self._transport:
830830
self._transport._force_close(exc)
831831

832-
if isinstance(exc, (BrokenPipeError,
833-
ConnectionResetError,
834-
ConnectionAbortedError)):
832+
if isinstance(exc, FATAL_SSL_ERROR_IGNORE):
835833
if self._loop.get_debug():
836834
aio_logger.debug("%r: %s", self, message, exc_info=True)
837835
elif not isinstance(exc, aio_CancelledError):

0 commit comments

Comments
 (0)