Skip to content

Commit

Permalink
Merge pull request #1286 from qstokkink/fix_inf_bootstrap
Browse files Browse the repository at this point in the history
Fixed bootstrap with infinite max_peers
  • Loading branch information
qstokkink authored Mar 7, 2024
2 parents f77fa8a + 058b050 commit cd5991e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ipv8/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async def _bootstrap(self, bootstrapper: Bootstrapper) -> None:
task = ensure_future(bootstrapper.initialize(self))

addresses = await bootstrapper.get_addresses(self, 60.0)
for address in islice(addresses, self.max_peers):
for address in (addresses if self.max_peers > 0 else islice(addresses, self.max_peers)):
self.walk_to(address)

await task
Expand Down
2 changes: 2 additions & 0 deletions ipv8/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import TYPE_CHECKING, Awaitable, Callable, Coroutine, Generic, Type, TypeVar, cast

from ..lazy_community import PacketDecodingError, lazy_wrapper, lazy_wrapper_unsigned
from ..messaging.interfaces.lan_addresses.interfaces import get_providers
from ..messaging.serialization import PackError
from ..overlay import Overlay
from ..peer import Peer
Expand Down Expand Up @@ -255,6 +256,7 @@ def setUp(self) -> None:
"""
self.loop.set_debug(True)
self.loop.set_exception_handler(self._cb_exception)
get_providers().clear()
super().setUp()
TestBase.__lockup_timestamp__ = time.time()

Expand Down

0 comments on commit cd5991e

Please sign in to comment.