mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Use None instead of empty string in socket.getaddrinfo() port (#3160)
The only reason there was an empty string is python 2.7 compatibility. Close #3144
This commit is contained in:
@@ -144,7 +144,7 @@ def validate_host_port(host_port: str, listen: bool = False, multiple_hosts: boo
|
|||||||
for host in hosts:
|
for host in hosts:
|
||||||
# Check if "socket.IF_INET" or "socket.IF_INET6" is being used and instantiate a socket with the identified
|
# Check if "socket.IF_INET" or "socket.IF_INET6" is being used and instantiate a socket with the identified
|
||||||
# protocol
|
# protocol
|
||||||
proto = socket.getaddrinfo(host, "", 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
|
proto = socket.getaddrinfo(host, None, 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
|
||||||
s = socket.socket(proto[0][0], socket.SOCK_STREAM)
|
s = socket.socket(proto[0][0], socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
if s.connect_ex((host, port)) == 0:
|
if s.connect_ex((host, port)) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user