mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 22:15:57 -05:00
Only wait for share mode rendezvous circuits to close, ignore the rest
This commit is contained in:
parent
752afcaa3a
commit
7927ef83b2
@ -353,7 +353,7 @@ def main(cwd=None):
|
|||||||
)
|
)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
app.start_onion_service(mode_settings, False, True)
|
app.start_onion_service(mode, mode_settings, False, True)
|
||||||
url = build_url(mode_settings, app, web)
|
url = build_url(mode_settings, app, web)
|
||||||
schedule = datetime.now() + timedelta(seconds=autostart_timer)
|
schedule = datetime.now() + timedelta(seconds=autostart_timer)
|
||||||
if mode == "receive":
|
if mode == "receive":
|
||||||
@ -389,9 +389,9 @@ def main(cwd=None):
|
|||||||
print("Waiting for the scheduled time before starting...")
|
print("Waiting for the scheduled time before starting...")
|
||||||
app.onion.cleanup(False)
|
app.onion.cleanup(False)
|
||||||
time.sleep(autostart_timer)
|
time.sleep(autostart_timer)
|
||||||
app.start_onion_service(mode_settings)
|
app.start_onion_service(mode, mode_settings)
|
||||||
else:
|
else:
|
||||||
app.start_onion_service(mode_settings)
|
app.start_onion_service(mode, mode_settings)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("")
|
print("")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -188,6 +188,9 @@ class Onion(object):
|
|||||||
# Assigned later if we are using stealth mode
|
# Assigned later if we are using stealth mode
|
||||||
self.auth_string = None
|
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(
|
def connect(
|
||||||
self,
|
self,
|
||||||
custom_settings=None,
|
custom_settings=None,
|
||||||
@ -611,7 +614,7 @@ class Onion(object):
|
|||||||
else:
|
else:
|
||||||
return False
|
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
|
Start a onion service on port 80, pointing to the given port, and
|
||||||
return the onion hostname.
|
return the onion hostname.
|
||||||
@ -691,6 +694,10 @@ class Onion(object):
|
|||||||
|
|
||||||
onion_host = res.service_id + ".onion"
|
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
|
# Save the service_id
|
||||||
mode_settings.set("general", "service_id", res.service_id)
|
mode_settings.set("general", "service_id", res.service_id)
|
||||||
|
|
||||||
@ -754,9 +761,11 @@ class Onion(object):
|
|||||||
try:
|
try:
|
||||||
rendevouz_circuit_ids = []
|
rendevouz_circuit_ids = []
|
||||||
for c in self.c.get_circuits():
|
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)
|
rendevouz_circuit_ids.append(c.id)
|
||||||
# print(f"id={c.id} purpose={c.purpose} rend_query={c.rend_query} type={c.type}")
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
num_rend_circuits = 0
|
num_rend_circuits = 0
|
||||||
|
@ -63,7 +63,7 @@ class OnionShare(object):
|
|||||||
except:
|
except:
|
||||||
raise OSError("Cannot find an available OnionShare port")
|
raise OSError("Cannot find an available OnionShare port")
|
||||||
|
|
||||||
def start_onion_service(self, mode_settings, await_publication=True):
|
def start_onion_service(self, mode, mode_settings, await_publication=True):
|
||||||
"""
|
"""
|
||||||
Start the onionshare onion service.
|
Start the onionshare onion service.
|
||||||
"""
|
"""
|
||||||
@ -80,7 +80,7 @@ class OnionShare(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.onion_host = self.onion.start_onion_service(
|
self.onion_host = self.onion.start_onion_service(
|
||||||
mode_settings, self.port, await_publication
|
mode, mode_settings, self.port, await_publication
|
||||||
)
|
)
|
||||||
|
|
||||||
if mode_settings.get("general", "client_auth"):
|
if mode_settings.get("general", "client_auth"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user