Properly handle errors for using stealth onion services in the GUI, instead of crashing in the background (#144)

This commit is contained in:
Micah Lee 2016-12-23 19:08:18 -08:00
parent 286573bda5
commit 6eed7258a7
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 11 additions and 2 deletions

View File

@ -50,7 +50,12 @@ class OnionShare(object):
self.transparent_torification = transparent_torification self.transparent_torification = transparent_torification
# use stealth onion service # use stealth onion service
self.set_stealth(stealth)
def set_stealth(self, stealth):
self.stealth = stealth self.stealth = stealth
if self.onion:
self.onion.stealth = stealth
def choose_port(self): def choose_port(self):
""" """

View File

@ -176,6 +176,10 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.starting_server_error.emit(e.args[0]) self.starting_server_error.emit(e.args[0])
return return
except onionshare.onion.TorTooOld as e:
self.starting_server_error.emit(e.args[0])
return
t = threading.Thread(target=start_onion_service, kwargs={'self': self}) t = threading.Thread(target=start_onion_service, kwargs={'self': self})
t.daemon = True t.daemon = True
t.start() t.start()

View File

@ -66,9 +66,9 @@ class Options(QtWidgets.QVBoxLayout):
When the 'stealth' checkbox is toggled, let the onionshare app know. When the 'stealth' checkbox is toggled, let the onionshare app know.
""" """
if state == 2: if state == 2:
self.app.stealth = True self.app.set_stealth(True)
else: else:
self.app.stealth = False self.app.set_stealth(False)
def set_stealth_enabled(self, enabled): def set_stealth_enabled(self, enabled):
""" """