提交 e897c174 编写于 作者: A Andy McCurdy

version 3.3.1, fixed a regression involving SSL and non-blocking sockets

Fixes #1197
上级 0de7c820
* 3.3.1
* Fixed a regression introduced in 3.3.1 involving SSL and non-blocking
sockets. #1197
* 3.3.0
* Resolve a race condition with the PubSubWorkerThread. #1150
* Cleanup socket read error messages. Thanks Vic Yu. #1159
......
......@@ -29,7 +29,7 @@ def int_or_str(value):
return value
__version__ = '3.3.0'
__version__ = '3.3.1'
VERSION = tuple(map(int_or_str, __version__.split('.')))
__all__ = [
......
......@@ -10,12 +10,6 @@ import sys
import threading
import warnings
try:
import ssl
ssl_available = True
except ImportError:
ssl_available = False
from redis._compat import (xrange, imap, byte_to_chr, unicode, long,
nativestr, basestring, iteritems,
LifoQueue, Empty, Full, urlparse, parse_qs,
......@@ -34,6 +28,23 @@ from redis.exceptions import (
TimeoutError,
)
from redis.utils import HIREDIS_AVAILABLE
try:
import ssl
ssl_available = True
except ImportError:
ssl_available = False
if ssl_available:
blocking_exceptions = (
BlockingIOError,
ssl.SSLWantReadError,
ssl.SSLWantWriteError
)
else:
blocking_exceptions = (BlockingIOError,)
if HIREDIS_AVAILABLE:
import hiredis
......@@ -168,7 +179,7 @@ class SocketBuffer(object):
if length is not None and length > marker:
continue
return True
except BlockingIOError as ex:
except blocking_exceptions as ex:
# if we're in nonblocking mode and the recv raises a
# blocking error, simply return False indicating that
# there's no data to be read. otherwise raise the
......@@ -397,7 +408,7 @@ class HiredisParser(BaseParser):
# data was read from the socket and added to the buffer.
# return True to indicate that data was read.
return True
except BlockingIOError as ex:
except blocking_exceptions as ex:
# if we're in nonblocking mode and the recv raises a
# blocking error, simply return False indicating that
# there's no data to be read. otherwise raise the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册