File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1818log = logging .getLogger (__name__ )
1919CONNECTION_EXPIRES_AFTER_SECONDS = 50
2020PREFIX = 'LB' # todo: PR BEP20 to add ourselves
21+ DEFAULT_TIMEOUT_SECONDS = 10.0
22+ DEFAULT_CONCURRENCY_LIMIT = 100
2123# see: http://bittorrent.org/beps/bep_0015.html and http://xbtt.sourceforge.net/udp_tracker_protocol.html
2224ConnectRequest = namedtuple ("ConnectRequest" , ["connection_id" , "action" , "transaction_id" ])
2325ConnectResponse = namedtuple ("ConnectResponse" , ["action" , "transaction_id" , "connection_id" ])
@@ -75,11 +77,11 @@ def make_peer_id(random_part: Optional[str] = None) -> bytes:
7577
7678
7779class UDPTrackerClientProtocol (asyncio .DatagramProtocol ):
78- def __init__ (self , timeout : float = 10.0 ):
80+ def __init__ (self , timeout : float = DEFAULT_TIMEOUT_SECONDS ):
7981 self .transport = None
8082 self .data_queue = {}
8183 self .timeout = timeout
82- self .semaphore = asyncio .Semaphore (10 )
84+ self .semaphore = asyncio .Semaphore (DEFAULT_CONCURRENCY_LIMIT )
8385
8486 def connection_made (self , transport : asyncio .DatagramTransport ) -> None :
8587 self .transport = transport
You can’t perform that action at this time.
0 commit comments