forked from LBRYCommunity/lbry-sdk
Merge pull request #2521 from lbryio/resolve-ipv4-only
fix resolving fixed peers from an ipv6 connection
This commit is contained in:
commit
292f1953e1
2 changed files with 3 additions and 2 deletions
|
@ -161,7 +161,7 @@ class KademliaPeer:
|
|||
if self.tcp_port is not None and not 1 <= self.tcp_port <= 65535:
|
||||
raise ValueError("invalid tcp port")
|
||||
if not is_valid_ipv4(self.address):
|
||||
raise ValueError("invalid ip address")
|
||||
raise ValueError(f"invalid ip address: '{self.address}'")
|
||||
|
||||
def update_tcp_port(self, tcp_port: int):
|
||||
self.tcp_port = tcp_port
|
||||
|
|
|
@ -192,7 +192,8 @@ async def resolve_host(url: str, port: int, proto: str) -> str:
|
|||
return (await loop.getaddrinfo(
|
||||
url, port,
|
||||
proto=socket.IPPROTO_TCP if proto == 'tcp' else socket.IPPROTO_UDP,
|
||||
type=socket.SOCK_STREAM if proto == 'tcp' else socket.SOCK_DGRAM
|
||||
type=socket.SOCK_STREAM if proto == 'tcp' else socket.SOCK_DGRAM,
|
||||
family=socket.AF_INET
|
||||
))[0][4][0]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue