Compare commits
No commits in common. "6b6d357a139c118ca02a7e301ad78ee003929188" and "7b0c761dd1251a60e6b82ab65a88b939e1a94e2c" have entirely different histories.
6b6d357a13
...
7b0c761dd1
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
ORIG_ONIONR_RUN_DIR=`pwd`
|
||||
export ORIG_ONIONR_RUN_DIR
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
cd "$(dirname "$0")"
|
||||
cd src
|
||||
./__init__.py "$@"
|
@ -8,6 +8,7 @@ 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,7 +81,6 @@ 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
|
||||
@ -97,17 +96,15 @@ 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 or not_enough_edges:
|
||||
while len(peer_sockets) < OUTBOUND_DANDELION_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(
|
||||
"Making too few edges for stemout " +
|
||||
"this is bad for anonymity if frequent."
|
||||
logger.warn("Not able to build enough tunnels for stemout.",
|
||||
terminal=True)
|
||||
not_enough_edges = True
|
||||
break
|
||||
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() + 1)
|
||||
new_queue.get(timeout=dandelion_phase.remaining_time())
|
||||
)
|
||||
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,
|
||||
gen_dirs = [home, filepaths.block_data_location,
|
||||
filepaths.contacts_location,
|
||||
filepaths.export_location]
|
||||
for path in gen_dirs:
|
||||
|
@ -8,19 +8,18 @@ from torpeer import TorPeer
|
||||
def on_announce_rec(api, data=None):
|
||||
socks_address, socks_port = get_socks()[0]
|
||||
|
||||
announced: str = data['address']
|
||||
announced = data['address']
|
||||
try:
|
||||
announced = announced.decode('utf-8')
|
||||
except AttributeError:
|
||||
pass
|
||||
announced = announced.strip()
|
||||
|
||||
if announced.removesuffix('.onion') == config.get(
|
||||
'tor.transport_address', '').removesuffix('.onion'):
|
||||
if announced == config.get('tor.transport_address'):
|
||||
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()
|
||||
get_new_peers()
|
||||
self.assertRaises(ValueError, get_new_peers)
|
||||
self.assertFalse(len(gossip_peer_set))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user