tracker:log DNS errors as warning instead of trace

This commit is contained in:
Victor Shyba 2022-03-10 21:15:39 -03:00
parent 7e6ea97499
commit a7cea4082e

View file

@ -1,4 +1,5 @@
import random
import socket
import string
import struct
import asyncio
@ -195,7 +196,11 @@ class TrackerClient:
async def _probe_server(self, info_hash, tracker_host, tracker_port, stopped=False):
result = None
self.results.setdefault(tracker_host, {})
tracker_host = await resolve_host(tracker_host, tracker_port, 'udp')
try:
tracker_host = await resolve_host(tracker_host, tracker_port, 'udp')
except socket.error:
log.warning("DNS failure while resolving tracker host: %s, skipping.", tracker_host)
return
if info_hash in self.results[tracker_host]:
next_announcement, result = self.results[tracker_host][info_hash]
if time.time() < next_announcement: