Added support for IPv6 address to send JSON request using rpc.py
modified: scripts/rpc/client.py Change-Id: I8d06ecde7222f482c6067cedf638a9e38567cdc7 Signed-off-by: suman chakraborty <suman.chakraborty@wdc.com> Reviewed-on: https://review.gerrithub.io/400445 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
5665dbd91f
commit
4990d65e2b
@ -25,6 +25,11 @@ class JSONRPCClient(object):
|
||||
if addr.startswith('/'):
|
||||
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
self.sock.connect(addr)
|
||||
elif ':' in addr:
|
||||
for res in socket.getaddrinfo(addr, port, socket.AF_INET6, socket.SOCK_STREAM, socket.SOL_TCP):
|
||||
af, socktype, proto, canonname, sa = res
|
||||
self.sock = socket.socket(af, socktype, proto)
|
||||
self.sock.connect(sa)
|
||||
else:
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.connect((addr, port))
|
||||
|
Loading…
Reference in New Issue
Block a user