Compare commits
3 Commits
7b0c761dd1
...
6b6d357a13
Author | SHA1 | Date | |
---|---|---|---|
|
6b6d357a13 | ||
|
ac88e0a1da | ||
|
cdccde2d9d |
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
ORIG_ONIONR_RUN_DIR=`pwd`
|
||||
export ORIG_ONIONR_RUN_DIR
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
cd "$(dirname "$0")"
|
||||
cd src
|
||||
./__init__.py "$@"
|
@ -8,7 +8,6 @@ app_root = os.path.dirname(os.path.realpath(__file__)) + '/../../'
|
||||
gossip_server_socket_file = home + 'gossip-server.sock'
|
||||
|
||||
usage_file = home + 'disk-usage.txt'
|
||||
block_data_location = home + 'blocks/'
|
||||
contacts_location = home + 'contacts/'
|
||||
public_API_host_file = home + 'public-host.txt'
|
||||
private_API_host_file = home + 'private-host.txt'
|
||||
|
@ -81,6 +81,7 @@ async def stem_out(d_phase: 'DandelionPhase'):
|
||||
if not len(gossip_peer_set):
|
||||
sleep(1)
|
||||
return
|
||||
not_enough_edges = False
|
||||
|
||||
# Spawn threads with deep copied block queue to add to db after time
|
||||
# for black hole attack
|
||||
@ -96,15 +97,17 @@ async def stem_out(d_phase: 'DandelionPhase'):
|
||||
# Using orderedset for the tried edges to ensure random pairing with queue
|
||||
tried_edges: "OrderedSet[Peer]" = OrderedSet()
|
||||
|
||||
while len(peer_sockets) < OUTBOUND_DANDELION_EDGES:
|
||||
while len(peer_sockets) < OUTBOUND_DANDELION_EDGES or not_enough_edges:
|
||||
try:
|
||||
# Get a socket for stem out (makes sure they accept)
|
||||
peer_sockets.append(await _setup_edge(gossip_peer_set, tried_edges))
|
||||
except NotEnoughEdges:
|
||||
# No possible edges at this point (edges < OUTBOUND_DANDELION_EDGE)
|
||||
logger.warn("Not able to build enough tunnels for stemout.",
|
||||
terminal=True)
|
||||
break
|
||||
logger.warn(
|
||||
"Making too few edges for stemout " +
|
||||
"this is bad for anonymity if frequent."
|
||||
terminal=True)
|
||||
not_enough_edges = True
|
||||
else:
|
||||
# Ran out of time for stem phase
|
||||
if not d_phase.is_stem_phase() or d_phase.remaining_time() < 5:
|
||||
|
@ -33,7 +33,7 @@ def store_blocks(dandelion_phase: 'DandelionPhase'):
|
||||
and dandelion_phase.remaining_time() > 1:
|
||||
try:
|
||||
blockdb.add_block_to_db(
|
||||
new_queue.get(timeout=dandelion_phase.remaining_time())
|
||||
new_queue.get(timeout=dandelion_phase.remaining_time() + 1)
|
||||
)
|
||||
except Empty:
|
||||
pass
|
||||
|
@ -31,7 +31,7 @@ def create_dirs():
|
||||
"""Create onionr data-related directories in
|
||||
order of the hardcoded list below,
|
||||
then trigger creation of DBs"""
|
||||
gen_dirs = [home, filepaths.block_data_location,
|
||||
gen_dirs = [home,
|
||||
filepaths.contacts_location,
|
||||
filepaths.export_location]
|
||||
for path in gen_dirs:
|
||||
|
@ -8,18 +8,19 @@ from torpeer import TorPeer
|
||||
def on_announce_rec(api, data=None):
|
||||
socks_address, socks_port = get_socks()[0]
|
||||
|
||||
announced = data['address']
|
||||
announced: str = data['address']
|
||||
try:
|
||||
announced = announced.decode('utf-8')
|
||||
except AttributeError:
|
||||
pass
|
||||
announced = announced.strip()
|
||||
|
||||
if announced == config.get('tor.transport_address'):
|
||||
if announced.removesuffix('.onion') == config.get(
|
||||
'tor.transport_address', '').removesuffix('.onion'):
|
||||
logger.warn(
|
||||
"Received announcement for our own node, which shouldn't happen")
|
||||
return
|
||||
|
||||
announced = announced.strip()
|
||||
if not announced.endswith('.onion'):
|
||||
announced += '.onion'
|
||||
|
||||
|
@ -71,7 +71,7 @@ class OnionrGossipClientGetNewPeers(unittest.TestCase):
|
||||
|
||||
def test_get_new_peers_no_peers(self):
|
||||
gossip_peer_set.clear()
|
||||
self.assertRaises(ValueError, get_new_peers)
|
||||
get_new_peers()
|
||||
self.assertFalse(len(gossip_peer_set))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user