Refactor onionshare CLI to use await_publication=True when using ephemeral onion services, instead of relying on wait_for_hs function

This commit is contained in:
Micah Lee 2016-09-05 11:29:12 -07:00
parent 1372239ed7
commit 360fb6cfcc
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 4 additions and 4 deletions

View File

@ -90,9 +90,9 @@ class Onion(object):
print(strings._("connecting_ctrlport").format(int(port)))
if self.supports_ephemeral:
print(strings._('using_ephemeral'))
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = False)
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = True)
self.service_id = res.content()[0][2].split('=')[1]
onion_host = res.content()[0][2].split('=')[1] + '.onion'
onion_host = self.service_id + '.onion'
return onion_host
else:

View File

@ -158,14 +158,14 @@ def main(cwd=None):
print(strings._("large_filesize"))
print('')
# start onionshare service in new thread
# start onionshare http service in new thread
t = threading.Thread(target=web.start, args=(app.port, app.stay_open, app.transparent_torification))
t.daemon = True
t.start()
try: # Trap Ctrl-C
# wait for hs, only if using old version of tor
if not app.local_only:
if not app.local_only and not app.onion.supports_ephemeral:
ready = app.onion.wait_for_hs(app.onion_host)
if not ready:
sys.exit()