Try mulitiple times and log an error if we can't bootstrap to anyone
This commit is contained in:
parent
44f6b90777
commit
1a7ce7d386
@ -1,3 +1,4 @@
|
|||||||
|
import threading
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from typing import TYPE_CHECKING, Set
|
from typing import TYPE_CHECKING, Set
|
||||||
from os import urandom
|
from os import urandom
|
||||||
@ -10,6 +11,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
from onionrthreads import add_onionr_thread
|
from onionrthreads import add_onionr_thread
|
||||||
import onionrplugins
|
import onionrplugins
|
||||||
|
import logger
|
||||||
|
|
||||||
from .connectpeer import connect_peer
|
from .connectpeer import connect_peer
|
||||||
from .client import gossip_client
|
from .client import gossip_client
|
||||||
@ -44,8 +46,18 @@ def start_gossip_threads(
|
|||||||
|
|
||||||
add_onionr_thread(
|
add_onionr_thread(
|
||||||
gossip_server, 1, peer_set, block_queue, seed, initial_sleep=0.2)
|
gossip_server, 1, peer_set, block_queue, seed, initial_sleep=0.2)
|
||||||
add_onionr_thread(
|
|
||||||
gossip_client, 1, peer_set, block_queue, seed, initial_sleep=0)
|
threading.Thread(
|
||||||
|
target=gossip_client,
|
||||||
|
args=[peer_set, block_queue, seed], daemon=True).start()
|
||||||
onionrplugins.events.event('gossip_start', data=peer_set, threaded=True)
|
onionrplugins.events.event('gossip_start', data=peer_set, threaded=True)
|
||||||
onionrplugins.events.event(
|
for _ in range(2):
|
||||||
'bootstrap', data={'peer_set': peer_set, 'callback': connect_peer})
|
onionrplugins.events.event(
|
||||||
|
'bootstrap', data={'peer_set': peer_set, 'callback': connect_peer},
|
||||||
|
threaded=False)
|
||||||
|
sleep(60)
|
||||||
|
if len(peer_set):
|
||||||
|
return
|
||||||
|
logger.error("Could not connect to any peers :(", terminal=True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user