Skip to content

Commit

Permalink
Allow socket type to be configured in Connection
Browse files Browse the repository at this point in the history
  • Loading branch information
garlicnation committed Nov 7, 2017
1 parent a228945 commit 293b5e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions redis/connection.py
Expand Up @@ -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()
Expand All @@ -450,6 +450,7 @@ def __init__(self, host='localhost', port=6379, db=0, password=None,
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
Expand Down Expand Up @@ -507,7 +508,7 @@ def _connect(self):
# 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
Expand Down

0 comments on commit 293b5e6

Please sign in to comment.