disable pool for mixing and announce node sooner after start

This commit is contained in:
Kevin Froman 2020-01-19 21:10:01 -06:00
parent c7bbd054e4
commit 3aeb305994
3 changed files with 7 additions and 14 deletions

View File

@ -213,7 +213,7 @@ class OnionrCommunicatorDaemon:
self, self,
announcenode.announce_node, announcenode.announce_node,
3600, my_args=[self], requires_peer=True, max_threads=1) 3600, my_args=[self], requires_peer=True, max_threads=1)
announceTimer.count = (announceTimer.frequency - 120) announceTimer.count = (announceTimer.frequency - 60)
else: else:
logger.debug('Will not announce node.') logger.debug('Will not announce node.')
@ -233,7 +233,7 @@ class OnionrCommunicatorDaemon:
shared_state.add(self) shared_state.add(self)
if config.get('general.use_bootstrap', True): if config.get('general.use_bootstrap_list', True):
bootstrappeers.add_bootstrap_list_to_peer_list( bootstrappeers.add_bootstrap_list_to_peer_list(
self, [], db_only=True) self, [], db_only=True)

View File

@ -95,8 +95,8 @@ def upload_blocks_from_communicator(comm_inst: 'OnionrCommunicatorDaemon'):
session.fail_peer(peer) session.fail_peer(peer)
comm_inst.getPeerProfileInstance(peer).addScore(-5) comm_inst.getPeerProfileInstance(peer).addScore(-5)
logger.warn( logger.warn(
f'Failed to upload {bl[:8]}, reason: {resp[:15]}', f'Failed to upload {bl[:8]}, reason: {resp}',
terminal=True) terminal=True)
else: else:
session.fail() session.fail()
session_manager.clean_session() session_manager.clean_session()

View File

@ -1,6 +1,6 @@
"""Onionr - Private P2P Communication. """Onionr - Private P2P Communication.
Delay block uploads, optionally mixing them together Perform block mixing
""" """
import time import time
from typing import List from typing import List
@ -41,12 +41,5 @@ def block_mixer(upload_list: List[onionrtypes.BlockHash],
if time.time() - bl.claimedTime > onionrvalues.BLOCK_POOL_MAX_AGE: if time.time() - bl.claimedTime > onionrvalues.BLOCK_POOL_MAX_AGE:
raise ValueError raise ValueError
if block_to_mix:
try: upload_list.append(block_to_mix)
# add the new block to pool
upload_pool.add_to_pool(block_to_mix)
except PoolFullException:
# If the pool is full, move into upload queue
upload_list.extend(upload_pool.get_pool())
# then finally begin new pool with new block
upload_pool.add_to_pool(block_to_mix)