mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-14 21:51:32 -05:00
Catch errors that occur when connection_type is bundled_tor, but the tor process closes before it can connect
This commit is contained in:
parent
ec7c893d9e
commit
62b5d64bc7
@ -105,6 +105,12 @@ class BundledTorCanceled(Exception):
|
|||||||
and the user cancels connecting to Tor
|
and the user cancels connecting to Tor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class BundledTorBroken(Exception):
|
||||||
|
"""
|
||||||
|
This exception is raised if onionshare is set to use the bundled Tor binary,
|
||||||
|
but the process seems to fail to run.
|
||||||
|
"""
|
||||||
|
|
||||||
class Onion(object):
|
class Onion(object):
|
||||||
"""
|
"""
|
||||||
Onion is an abstraction layer for connecting to the Tor control port and
|
Onion is an abstraction layer for connecting to the Tor control port and
|
||||||
@ -202,12 +208,15 @@ class Onion(object):
|
|||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
# Connect to the controller
|
# Connect to the controller
|
||||||
|
try:
|
||||||
if self.system == 'Windows':
|
if self.system == 'Windows':
|
||||||
self.c = Controller.from_port(port=self.tor_control_port)
|
self.c = Controller.from_port(port=self.tor_control_port)
|
||||||
self.c.authenticate()
|
self.c.authenticate()
|
||||||
else:
|
else:
|
||||||
self.c = Controller.from_socket_file(path=self.tor_control_socket)
|
self.c = Controller.from_socket_file(path=self.tor_control_socket)
|
||||||
self.c.authenticate()
|
self.c.authenticate()
|
||||||
|
except Exception as e:
|
||||||
|
raise BundledTorBroken(strings._('settings_error_bundled_tor_broken', True).format(e.args[0]))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -91,6 +91,7 @@
|
|||||||
"settings_error_bundled_tor_not_supported": "Bundled Tor is not supported when not using developer mode in Windows or macOS.",
|
"settings_error_bundled_tor_not_supported": "Bundled Tor is not supported when not using developer mode in Windows or macOS.",
|
||||||
"settings_error_bundled_tor_timeout": "Connecting to Tor is taking too long. Maybe your computer is offline, or your clock isn't accurate.",
|
"settings_error_bundled_tor_timeout": "Connecting to Tor is taking too long. Maybe your computer is offline, or your clock isn't accurate.",
|
||||||
"settings_error_bundled_tor_canceled": "The Tor process closed before it could finish connecting.",
|
"settings_error_bundled_tor_canceled": "The Tor process closed before it could finish connecting.",
|
||||||
|
"settings_error_bundled_tor_broken": "Something is wrong with OnionShare connecting to Tor in the background:\n{}",
|
||||||
"settings_test_success": "Congratulations, OnionShare can connect to the Tor controller.\n\nTor version: {}\nSupports ephemeral onion services: {}\nSupports stealth onion services: {}",
|
"settings_test_success": "Congratulations, OnionShare can connect to the Tor controller.\n\nTor version: {}\nSupports ephemeral onion services: {}\nSupports stealth onion services: {}",
|
||||||
"error_tor_protocol_error": "Error talking to the Tor controller.\nIf you're using Whonix, check out https://www.whonix.org/wiki/onionshare to make OnionShare work.",
|
"error_tor_protocol_error": "Error talking to the Tor controller.\nIf you're using Whonix, check out https://www.whonix.org/wiki/onionshare to make OnionShare work.",
|
||||||
"connecting_to_tor": "Connecting to the Tor network",
|
"connecting_to_tor": "Connecting to the Tor network",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user