Skip to content

Commit 77d569c

Browse files
committed
Merge pull request #4 from ConConovaloff/protocol_selection
Opportunity to select the protocol in a Address
2 parents 2a5adce + ef29f62 commit 77d569c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

msgpackrpc/address.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class Address(object):
88
The class to represent the RPC address.
99
"""
1010

11-
def __init__(self, host, port):
11+
def __init__(self, host, port, family=socket.AF_UNSPEC):
1212
self._host = host
1313
self._port = port
14+
self._family = family
1415

1516
@property
1617
def host(self):
@@ -23,8 +24,8 @@ def port(self):
2324
def unpack(self):
2425
return (self._host, self._port)
2526

26-
def socket(self, family=socket.AF_UNSPEC):
27-
res = socket.getaddrinfo(self._host, self._port, family,
27+
def socket(self):
28+
res = socket.getaddrinfo(self._host, self._port, self._family,
2829
socket.SOCK_STREAM, 0, socket.AI_PASSIVE)[0]
2930
af, socktype, proto, canonname, sockaddr = res
3031
sock = socket.socket(af, socktype, proto)

0 commit comments

Comments
 (0)