mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-13 16:29:31 -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
22c13fc7bf
commit
d3a7eef95c
@ -105,6 +105,12 @@ class BundledTorCanceled(Exception):
|
||||
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):
|
||||
"""
|
||||
Onion is an abstraction layer for connecting to the Tor control port and
|
||||
@ -202,12 +208,15 @@ class Onion(object):
|
||||
time.sleep(0.2)
|
||||
|
||||
# Connect to the controller
|
||||
if self.system == 'Windows':
|
||||
self.c = Controller.from_port(port=self.tor_control_port)
|
||||
self.c.authenticate()
|
||||
else:
|
||||
self.c = Controller.from_socket_file(path=self.tor_control_socket)
|
||||
self.c.authenticate()
|
||||
try:
|
||||
if self.system == 'Windows':
|
||||
self.c = Controller.from_port(port=self.tor_control_port)
|
||||
self.c.authenticate()
|
||||
else:
|
||||
self.c = Controller.from_socket_file(path=self.tor_control_socket)
|
||||
self.c.authenticate()
|
||||
except Exception as e:
|
||||
raise BundledTorBroken(strings._('settings_error_bundled_tor_broken', True).format(e.args[0]))
|
||||
|
||||
while True:
|
||||
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_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_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: {}",
|
||||
"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",
|
||||
|
Loading…
Reference in New Issue
Block a user