Skip to content

Commit 3ff3d75

Browse files
Ormoddpkp
authored andcommitted
conn: Catch ssl.EOFErrors on Python3.3 so we close the failing conn (#1162)
1 parent 1664374 commit 3ff3d75

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kafka/conn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import ssl
3636
ssl_available = True
3737
try:
38+
SSLEOFError = ssl.SSLEOFError
3839
SSLWantReadError = ssl.SSLWantReadError
3940
SSLWantWriteError = ssl.SSLWantWriteError
4041
SSLZeroReturnError = ssl.SSLZeroReturnError
@@ -43,6 +44,7 @@
4344
log.warning('Old SSL module detected.'
4445
' SSL error handling may not operate cleanly.'
4546
' Consider upgrading to Python 3.3 or 2.7.9')
47+
SSLEOFError = ssl.SSLError
4648
SSLWantReadError = ssl.SSLError
4749
SSLWantWriteError = ssl.SSLError
4850
SSLZeroReturnError = ssl.SSLError
@@ -421,7 +423,7 @@ def _try_handshake(self):
421423
# old ssl in python2.6 will swallow all SSLErrors here...
422424
except (SSLWantReadError, SSLWantWriteError):
423425
pass
424-
except (SSLZeroReturnError, ConnectionError):
426+
except (SSLZeroReturnError, ConnectionError, SSLEOFError):
425427
log.warning('SSL connection closed by server during handshake.')
426428
self.close(Errors.ConnectionError('SSL connection closed by server during handshake'))
427429
# Other SSLErrors will be raised to user

0 commit comments

Comments
 (0)