aboutsummaryrefslogtreecommitdiff
path: root/cli/onionshare_cli/onion.py
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2020-11-27 11:22:29 -0800
committerMicah Lee <micah@micahflee.com>2020-11-27 11:22:29 -0800
commit7927ef83b235e1219f7825e740db9ce216147aee (patch)
tree3fadf5ab0ca2fad04b4f3d2d6f881ec294b00780 /cli/onionshare_cli/onion.py
parent752afcaa3a62785296d06baeb44ba00a4f30ad46 (diff)
downloadonionshare-7927ef83b235e1219f7825e740db9ce216147aee.tar.gz
onionshare-7927ef83b235e1219f7825e740db9ce216147aee.zip
Only wait for share mode rendezvous circuits to close, ignore the rest
Diffstat (limited to 'cli/onionshare_cli/onion.py')
-rw-r--r--cli/onionshare_cli/onion.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/onionshare_cli/onion.py b/cli/onionshare_cli/onion.py
index f10401da..b801997d 100644
--- a/cli/onionshare_cli/onion.py
+++ b/cli/onionshare_cli/onion.py
@@ -188,6 +188,9 @@ class Onion(object):
# Assigned later if we are using stealth mode
self.auth_string = None
+ # Keep track of onions where it's important to gracefully close to prevent truncated downloads
+ self.graceful_close_onions = []
+
def connect(
self,
custom_settings=None,
@@ -611,7 +614,7 @@ class Onion(object):
else:
return False
- def start_onion_service(self, mode_settings, port, await_publication):
+ def start_onion_service(self, mode, mode_settings, port, await_publication):
"""
Start a onion service on port 80, pointing to the given port, and
return the onion hostname.
@@ -691,6 +694,10 @@ class Onion(object):
onion_host = res.service_id + ".onion"
+ # Gracefully close share mode rendezvous circuits
+ if mode == "share":
+ self.graceful_close_onions.append(res.service_id)
+
# Save the service_id
mode_settings.set("general", "service_id", res.service_id)
@@ -754,9 +761,11 @@ class Onion(object):
try:
rendevouz_circuit_ids = []
for c in self.c.get_circuits():
- if c.purpose == "HS_SERVICE_REND":
+ if (
+ c.purpose == "HS_SERVICE_REND"
+ and c.rend_query in self.graceful_close_onions
+ ):
rendevouz_circuit_ids.append(c.id)
- # print(f"id={c.id} purpose={c.purpose} rend_query={c.rend_query} type={c.type}")
while True:
num_rend_circuits = 0