Tribler/py-ipv8

Community `_bootstrap` cannot deal with infinite max peers

Closed this issue · 0 comments

When setting max_peers to -1 (infinity) the _bootstrap method stops working:

ERROR:asyncio:Exception in callback TaskManager.register_task.<locals>.done_cb(<Task finishe...ys.maxsize.')>) at C:\Python312\Lib\site-packages\ipv8\taskmanager.py:150
handle: <Handle TaskManager.register_task.<locals>.done_cb(<Task finishe...ys.maxsize.')>) at C:\Python312\Lib\site-packages\ipv8\taskmanager.py:150>
Traceback (most recent call last):
  File "C:\Python312\Python312\Lib\asyncio\events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Python312\Lib\site-packages\ipv8\taskmanager.py", line 153, in done_cb
    future.result()
  File "C:\Python312\Lib\site-packages\ipv8\community.py", line 224, in _bootstrap
    for address in islice(addresses, self.max_peers):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.

This is an issue for crawlers.