mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-06 08:25:15 -04:00
Fixes for the edge case where Tor connection dialog is canceled, but the Tor process remains open in the background, which was causing onion.is_authenticated() to True. Remove excessive alerts
This commit is contained in:
parent
b442b5d41b
commit
6f4d7f7f44
5 changed files with 15 additions and 8 deletions
|
@ -380,7 +380,7 @@ class Onion(object):
|
||||||
"""
|
"""
|
||||||
Returns True if the Tor connection is still working, or False otherwise.
|
Returns True if the Tor connection is still working, or False otherwise.
|
||||||
"""
|
"""
|
||||||
if self.c:
|
if self.c is not None:
|
||||||
return self.c.is_authenticated()
|
return self.c.is_authenticated()
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -176,6 +176,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
quit, or open settings.
|
quit, or open settings.
|
||||||
"""
|
"""
|
||||||
common.log('OnionShareGui', '_tor_connection_canceled')
|
common.log('OnionShareGui', '_tor_connection_canceled')
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
def ask():
|
def ask():
|
||||||
a = Alert(strings._('gui_tor_connection_ask', True), QtWidgets.QMessageBox.Question, buttons=QtWidgets.QMessageBox.NoButton, autostart=False)
|
a = Alert(strings._('gui_tor_connection_ask', True), QtWidgets.QMessageBox.Question, buttons=QtWidgets.QMessageBox.NoButton, autostart=False)
|
||||||
|
@ -394,10 +395,13 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
"""
|
"""
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
# Has the Tor Connection dialog finished, but we've since lost connection to Tor somehow?
|
# Have we lost connection to Tor somehow?
|
||||||
if not self.onion.is_authenticated() and self.tor_con.t.isFinished():
|
if self.tor_con.t.isFinished():
|
||||||
|
if not self.onion.is_authenticated():
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
self.start_server_error(strings._('error_tor_protocol_error'))
|
if self.server_status.status != self.server_status.STATUS_STOPPED:
|
||||||
|
self.server_status.stop_server()
|
||||||
|
self.status_bar.clearMessage()
|
||||||
self._tor_connection_canceled()
|
self._tor_connection_canceled()
|
||||||
|
|
||||||
# scroll to the bottom of the dl progress bar log pane
|
# scroll to the bottom of the dl progress bar log pane
|
||||||
|
|
|
@ -460,6 +460,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
# the Onion object
|
# the Onion object
|
||||||
reboot_onion = False
|
reboot_onion = False
|
||||||
if self.onion.is_authenticated():
|
if self.onion.is_authenticated():
|
||||||
|
common.log('SettingsDialog', 'save_clicked', 'Connected to Tor')
|
||||||
def changed(s1, s2, keys):
|
def changed(s1, s2, keys):
|
||||||
"""
|
"""
|
||||||
Compare the Settings objects s1 and s2 and return true if any values
|
Compare the Settings objects s1 and s2 and return true if any values
|
||||||
|
@ -478,6 +479,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
reboot_onion = True
|
reboot_onion = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
common.log('SettingsDialog', 'save_clicked', 'Not connected to Tor')
|
||||||
# Tor isn't connected, so try connecting
|
# Tor isn't connected, so try connecting
|
||||||
reboot_onion = True
|
reboot_onion = True
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
|
||||||
def _canceled_connecting_to_tor(self):
|
def _canceled_connecting_to_tor(self):
|
||||||
common.log('TorConnectionDialog', '_canceled_connecting_to_tor')
|
common.log('TorConnectionDialog', '_canceled_connecting_to_tor')
|
||||||
self.active = False
|
self.active = False
|
||||||
|
self.onion.cleanup()
|
||||||
|
|
||||||
# Cancel connecting to Tor
|
# Cancel connecting to Tor
|
||||||
QtCore.QTimer.singleShot(1, self.cancel)
|
QtCore.QTimer.singleShot(1, self.cancel)
|
||||||
|
@ -126,7 +127,7 @@ class TorConnectionThread(QtCore.QThread):
|
||||||
# Connect to the Onion
|
# Connect to the Onion
|
||||||
try:
|
try:
|
||||||
self.onion.connect(self.settings, False, self._tor_status_update)
|
self.onion.connect(self.settings, False, self._tor_status_update)
|
||||||
if self.onion.is_authenticated():
|
if self.onion.connected_to_tor:
|
||||||
self.connected_to_tor.emit()
|
self.connected_to_tor.emit()
|
||||||
else:
|
else:
|
||||||
self.canceled_connecting_to_tor.emit()
|
self.canceled_connecting_to_tor.emit()
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
"update_error_check_error": "Error checking for updates: Maybe you're not connected to Tor, or maybe the OnionShare website is down.",
|
"update_error_check_error": "Error checking for updates: Maybe you're not connected to Tor, or maybe the OnionShare website is down.",
|
||||||
"update_error_invalid_latest_version": "Error checking for updates: The OnionShare website responded saying the latest version is '{}', but that doesn't appear to be a valid version string.",
|
"update_error_invalid_latest_version": "Error checking for updates: The OnionShare website responded saying the latest version is '{}', but that doesn't appear to be a valid version string.",
|
||||||
"update_not_available": "You are running the latest version of OnionShare.",
|
"update_not_available": "You are running the latest version of OnionShare.",
|
||||||
"gui_tor_connection_ask": "Would you like to open OnionShare settings to troubleshoot connecting to Tor?",
|
"gui_tor_connection_ask": "Tor isn't running.\n\nWould you like to open OnionShare settings to troubleshoot connecting to Tor?",
|
||||||
"gui_tor_connection_ask_open_settings": "Open Settings",
|
"gui_tor_connection_ask_open_settings": "Open Settings",
|
||||||
"gui_tor_connection_ask_quit": "Quit",
|
"gui_tor_connection_ask_quit": "Quit",
|
||||||
"gui_tor_connection_error_settings": "Try adjusting how OnionShare connects to the Tor network in Settings.",
|
"gui_tor_connection_error_settings": "Try adjusting how OnionShare connects to the Tor network in Settings.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue