TrackerShare: ignore the udp:// protocol, when UDP is known to be disabled by the config

This commit is contained in:
Vadim Ushakov 2019-07-13 15:36:05 +07:00
parent eb6d0c9644
commit d57deaa8e4

View file

@ -75,6 +75,9 @@ class TrackerStorage(object):
if not self.isTrackerAddressValid(address):
del trackers[address]
def isUdpEnabled(self):
return not (config.disable_udp or config.trackers_proxy != "disable")
def getNormalizedTrackerProtocol(self, tracker_address):
if not self.site_announcer:
return None
@ -111,6 +114,8 @@ class TrackerStorage(object):
protocol = self.getNormalizedTrackerProtocol(tracker_address)
if not protocol:
continue
if protocol == "udp" and not self.isUdpEnabled():
continue
protocols.add(protocol)
protocols = list(protocols)