diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2017-11-07 14:01:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-07 14:01:41 -0800 |
commit | 5109cb4f6b610e8d5949716a16435afbbf35075a (patch) | |
tree | 1a1a345ec97f87bc77880e9daf9fc2ab2ecf1cd4 | |
parent | a228945f1acaf5873dbb963360385198b3058ef3 (diff) | |
parent | 293b5e65e3f970c2e7c904ff3597ba51fde8eb36 (diff) | |
download | redis-py-5109cb4f6b610e8d5949716a16435afbbf35075a.tar.gz |
Merge pull request #921 from garlicnation/garlicnation-patch-1
Allow socket type to be configured in Connection
-rwxr-xr-x | redis/connection.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py index c8f0513..6ad467a 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -438,7 +438,7 @@ class Connection(object): def __init__(self, host='localhost', port=6379, db=0, password=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=False, socket_keepalive_options=None, - retry_on_timeout=False, encoding='utf-8', + socket_type=0, retry_on_timeout=False, encoding='utf-8', encoding_errors='strict', decode_responses=False, parser_class=DefaultParser, socket_read_size=65536): self.pid = os.getpid() @@ -450,6 +450,7 @@ class Connection(object): self.socket_connect_timeout = socket_connect_timeout or socket_timeout self.socket_keepalive = socket_keepalive self.socket_keepalive_options = socket_keepalive_options or {} + self.socket_type = socket_type self.retry_on_timeout = retry_on_timeout self.encoder = Encoder(encoding, encoding_errors, decode_responses) self._sock = None @@ -507,7 +508,7 @@ class Connection(object): # ipv4/ipv6, but we want to set options prior to calling # socket.connect() err = None - for res in socket.getaddrinfo(self.host, self.port, 0, + for res in socket.getaddrinfo(self.host, self.port, self.socket_type, socket.SOCK_STREAM): family, socktype, proto, canonname, socket_address = res sock = None |