connect: Correctly handle IPv4 addresses
It seems that the "shortcut" of using the `AF_INET6` address family for both IPv4 and IPv6 address does not always work. As such, we have to determine the correct family for the address by calling `getaddrinfo`.master
parent
28c991fe26
commit
b32e502597
|
@ -255,11 +255,21 @@ class Marionette(WebDriverBase):
|
|||
self.port,
|
||||
)
|
||||
try:
|
||||
res = await loop.getaddrinfo(
|
||||
self.host, self.port, type=socket.SOCK_STREAM
|
||||
)
|
||||
if res:
|
||||
family = res[0][0]
|
||||
host, port = res[0][4][:2]
|
||||
else:
|
||||
host = self.host
|
||||
port = self.port
|
||||
family = socket.AF_INET
|
||||
transport, _protocol = await loop.create_connection(
|
||||
lambda: _MarionetteProtocol(self),
|
||||
host=self.host,
|
||||
port=self.port,
|
||||
family=socket.AF_INET6,
|
||||
host=host,
|
||||
port=port,
|
||||
family=family,
|
||||
)
|
||||
fut = self._waiting[-1] = loop.create_future()
|
||||
hello: Dict[str, Any] = await fut
|
||||
|
|
Loading…
Reference in New Issue