This commit is contained in:
Lex Berezhny 2021-06-14 13:15:15 -04:00
parent 7d49b046d4
commit 0946c72b88

View file

@ -239,14 +239,14 @@ class Network:
else: else:
hubs = self.config['default_servers'] hubs = self.config['default_servers']
await asyncio.gather(*(resolve_spv(server, port) for (server, port) in hubs)) await asyncio.gather(*(resolve_spv(server, port) for (server, port) in hubs))
return hubs, hostname_to_ip, ip_to_hostnames return hostname_to_ip, ip_to_hostnames
async def get_n_fastest_spvs(self, timeout=3.0) -> Dict[Tuple[str, int], Optional[SPVPong]]: async def get_n_fastest_spvs(self, timeout=3.0) -> Dict[Tuple[str, int], Optional[SPVPong]]:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
pong_responses = asyncio.Queue() pong_responses = asyncio.Queue()
connection = SPVStatusClientProtocol(pong_responses) connection = SPVStatusClientProtocol(pong_responses)
sent_ping_timestamps = {} sent_ping_timestamps = {}
hubs, _, ip_to_hostnames = await self.resolve_spv_dns() _, ip_to_hostnames = await self.resolve_spv_dns()
n = len(ip_to_hostnames) n = len(ip_to_hostnames)
log.info("%i possible spv servers to try (%i urls in config)", n, len(self.config['explicit_servers'])) log.info("%i possible spv servers to try (%i urls in config)", n, len(self.config['explicit_servers']))
pongs = {} pongs = {}