Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bootstrap with infinite max_peers #1286

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading