Fix tor announcing to itsself
This commit is contained in:
parent
9864fa5040
commit
228d3cbe35
@ -83,7 +83,7 @@ def stream_from_peers():
|
||||
|
||||
while stream_times >= stream_counter:
|
||||
stream_counter += 1
|
||||
logger.debug("Reading block id in stream with " + peer.transport_address, terminal=True)
|
||||
logger.debug("Reading block of id in stream with " + peer.transport_address, terminal=True)
|
||||
sock.settimeout(5)
|
||||
block_id = sock.recv(BLOCK_ID_SIZE)
|
||||
if blockdb.has_block(block_id):
|
||||
@ -91,7 +91,7 @@ def stream_from_peers():
|
||||
continue
|
||||
sock.sendall(int(1).to_bytes(1, 'big'))
|
||||
|
||||
logger.debug("Reading block size in stream", terminal=True)
|
||||
#logger.debug("Reading block size in stream", terminal=True)
|
||||
|
||||
sock.settimeout(5)
|
||||
block_size = int(sock.recv(BLOCK_SIZE_LEN))
|
||||
@ -104,9 +104,9 @@ def stream_from_peers():
|
||||
sock.settimeout(5)
|
||||
block_data = sock.recv(block_size)
|
||||
|
||||
logger.debug(
|
||||
"We got a block from stream, assuming it is valid",
|
||||
terminal=True)
|
||||
#logger.debug(
|
||||
# "We got a block from stream, assuming it is valid",
|
||||
# terminal=True)
|
||||
try:
|
||||
blockdb.add_block_to_db(
|
||||
onionrblocks.Block(
|
||||
@ -119,7 +119,8 @@ def stream_from_peers():
|
||||
# Tell them to keep streaming
|
||||
sock.sendall(int(1).to_bytes(1, 'big'))
|
||||
except (BrokenPipeError, TimeoutError) as e:
|
||||
logger.debug(f"{e} when streaming peers", terminal=True)
|
||||
pass
|
||||
#logger.debug(f"{e} when streaming from peers", terminal=True)
|
||||
#logger.debug(traceback.format_exc())
|
||||
except Exception:
|
||||
logger.warn(traceback.format_exc(), terminal=True)
|
||||
|
@ -37,3 +37,4 @@ def delete_run_files():
|
||||
_safe_remove(filepaths.private_API_host_file)
|
||||
_safe_remove(filepaths.daemon_mark_file)
|
||||
_safe_remove(filepaths.lock_file)
|
||||
_safe_remove(filepaths.gossip_server_socket_file)
|
||||
|
@ -19,8 +19,8 @@ def on_announce_rec(api, data=None):
|
||||
socks_address, socks_port = get_socks()[0]
|
||||
|
||||
|
||||
if announced.removesuffix('.onion') == config.get(
|
||||
'tor.transport_address', '').removesuffix('.onion'):
|
||||
if announced.replace('.onion', '') == config.get(
|
||||
'tor.transport_address', '').replace('.onion', ''):
|
||||
return
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ def on_bootstrap(api, data):
|
||||
bootstrap_nodes = set(bootstrap_file_obj.read().split(','))
|
||||
except FileNotFoundError:
|
||||
bootstrap_nodes = set()
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
logger.warn(traceback.format_exc(), terminal=True)
|
||||
return
|
||||
else:
|
||||
@ -62,7 +62,7 @@ def on_bootstrap(api, data):
|
||||
socks_address, socks_port = get_socks()[0]
|
||||
|
||||
for address in bootstrap_nodes:
|
||||
if address == config.get('tor.transport_address') or not address:
|
||||
if address == config.get('tor.transport_address').replace('.onion', '') or not address:
|
||||
continue
|
||||
assert not address.endswith('.onion')
|
||||
address += '.onion'
|
||||
|
Loading…
Reference in New Issue
Block a user