mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-25 23:10:38 -04:00
Merge branch '493_500_detect_broken_tor_connection' of https://github.com/mig5/onionshare into mig5-493_500_detect_broken_tor_connection
This commit is contained in:
commit
ebbe490a65
5 changed files with 51 additions and 14 deletions
|
@ -142,10 +142,10 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
self.set_server_active(False)
|
||||
|
||||
# Start the "Connecting to Tor" dialog, which calls onion.connect()
|
||||
tor_con = TorConnectionDialog(self.qtapp, self.settings, self.onion)
|
||||
tor_con.canceled.connect(self._tor_connection_canceled)
|
||||
tor_con.open_settings.connect(self._tor_connection_open_settings)
|
||||
tor_con.start()
|
||||
self.tor_con = TorConnectionDialog(self.qtapp, self.settings, self.onion)
|
||||
self.tor_con.canceled.connect(self._tor_connection_canceled)
|
||||
self.tor_con.open_settings.connect(self._tor_connection_open_settings)
|
||||
self.tor_con.start()
|
||||
|
||||
# After connecting to Tor, check for updates
|
||||
self.check_for_updates()
|
||||
|
@ -219,6 +219,17 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
def reload_settings():
|
||||
common.log('OnionShareGui', 'open_settings', 'settings have changed, reloading')
|
||||
self.settings.load()
|
||||
# We might've stopped the main requests timer if a Tor connection failed.
|
||||
# If we've reloaded settings, we probably succeeded in obtaining a new
|
||||
# connection. If so, restart the timer.
|
||||
if self.onion.is_authenticated():
|
||||
if not self.timer.isActive():
|
||||
self.timer.start()
|
||||
# If there were some files listed for sharing, we should be ok to
|
||||
# re-enable the 'Start Sharing' button now.
|
||||
if self.server_status.file_selection.get_num_files() > 0:
|
||||
self.server_status.server_button.setEnabled(True)
|
||||
self.status_bar.clearMessage()
|
||||
|
||||
d = SettingsDialog(self.onion, self.qtapp, self.config)
|
||||
d.settings_saved.connect(reload_settings)
|
||||
|
@ -398,6 +409,17 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
"""
|
||||
self.update()
|
||||
|
||||
# Have we lost connection to Tor somehow?
|
||||
if self.tor_con.t.isFinished():
|
||||
if not self.onion.is_authenticated():
|
||||
self.timer.stop()
|
||||
if self.server_status.status != self.server_status.STATUS_STOPPED:
|
||||
self.server_status.stop_server()
|
||||
self.server_status.server_button.setEnabled(False)
|
||||
self.status_bar.showMessage(strings._('gui_tor_connection_lost', True))
|
||||
if self.systemTray.supportsMessages() and self.settings.get('systray_notifications'):
|
||||
self.systemTray.showMessage(strings._('gui_tor_connection_lost', True), strings._('gui_tor_connection_error_settings', True))
|
||||
|
||||
# scroll to the bottom of the dl progress bar log pane
|
||||
# if a new download has been added
|
||||
if self.new_download:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue