summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannu Valtonen <hannu.valtonen@aiven.io>2017-08-01 23:52:41 +0300
committerDana Powers <dana.powers@gmail.com>2017-08-01 13:52:41 -0700
commit3ff3d75004f94fd55fa089297d3e2376e33ccda7 (patch)
tree6601cfe54ca8259a1c6091d0f1753536bb18c4fb
parent16643748cdedb2f1b27d4bce80a8d858eb33776b (diff)
downloadkafka-python-3ff3d75004f94fd55fa089297d3e2376e33ccda7.tar.gz
conn: Catch ssl.EOFErrors on Python3.3 so we close the failing conn (#1162)
-rw-r--r--kafka/conn.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index 16eaf62..6a9c200 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -35,6 +35,7 @@ try:
import ssl
ssl_available = True
try:
+ SSLEOFError = ssl.SSLEOFError
SSLWantReadError = ssl.SSLWantReadError
SSLWantWriteError = ssl.SSLWantWriteError
SSLZeroReturnError = ssl.SSLZeroReturnError
@@ -43,6 +44,7 @@ try:
log.warning('Old SSL module detected.'
' SSL error handling may not operate cleanly.'
' Consider upgrading to Python 3.3 or 2.7.9')
+ SSLEOFError = ssl.SSLError
SSLWantReadError = ssl.SSLError
SSLWantWriteError = ssl.SSLError
SSLZeroReturnError = ssl.SSLError
@@ -421,7 +423,7 @@ class BrokerConnection(object):
# old ssl in python2.6 will swallow all SSLErrors here...
except (SSLWantReadError, SSLWantWriteError):
pass
- except (SSLZeroReturnError, ConnectionError):
+ except (SSLZeroReturnError, ConnectionError, SSLEOFError):
log.warning('SSL connection closed by server during handshake.')
self.close(Errors.ConnectionError('SSL connection closed by server during handshake'))
# Other SSLErrors will be raised to user