diff options
author | Thomas Steinacher <tom@eggdrop.ch> | 2016-05-24 16:20:17 -0700 |
---|---|---|
committer | Thomas Steinacher <tom@eggdrop.ch> | 2016-05-24 16:21:18 -0700 |
commit | 2b59b25bb08ea09e98aede1b1f23a270fc085a9f (patch) | |
tree | 75234f28f545e84a383dea2e36f68d8189b7daab /redis/connection.py | |
parent | 5ef18fd517a50ec04a0a8db353fdba2872c47d61 (diff) | |
download | redis-py-2b59b25bb08ea09e98aede1b1f23a270fc085a9f.tar.gz |
For Python < 3.5, automatically retry EINTR
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-x | redis/connection.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/redis/connection.py b/redis/connection.py index 004c7a6..a552820 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -17,7 +17,7 @@ except ImportError: from redis._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long, BytesIO, nativestr, basestring, iteritems, LifoQueue, Empty, Full, urlparse, parse_qs, - unquote) + recv, recv_into, unquote) from redis.exceptions import ( RedisError, ConnectionError, @@ -123,7 +123,7 @@ class SocketBuffer(object): try: while True: - data = self._sock.recv(socket_read_size) + data = recv(self._sock, socket_read_size) # an empty string indicates the server shutdown the socket if isinstance(data, bytes) and len(data) == 0: raise socket.error(SERVER_CLOSED_CONNECTION_ERROR) @@ -341,11 +341,11 @@ class HiredisParser(BaseParser): while response is False: try: if HIREDIS_USE_BYTE_BUFFER: - bufflen = self._sock.recv_into(self._buffer) + bufflen = recv_into(self._sock, self._buffer) if bufflen == 0: raise socket.error(SERVER_CLOSED_CONNECTION_ERROR) else: - buffer = self._sock.recv(socket_read_size) + buffer = recv(self._sock, socket_read_size) # an empty string indicates the server shutdown the socket if not isinstance(buffer, bytes) or len(buffer) == 0: raise socket.error(SERVER_CLOSED_CONNECTION_ERROR) |