mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-21 04:54:14 -04:00
Make sure tor process is killed in a more robust manner, and also increase tor connection timeout to 45 seconds
This commit is contained in:
parent
c4997429a2
commit
be2b086cc4
1 changed files with 6 additions and 3 deletions
|
@ -136,7 +136,7 @@ class Onion(object):
|
||||||
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path) = helpers.get_tor_paths()
|
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path) = helpers.get_tor_paths()
|
||||||
|
|
||||||
# The tor process
|
# The tor process
|
||||||
self.tor_p = None
|
self.tor_proc = None
|
||||||
|
|
||||||
# Try to connect to Tor
|
# Try to connect to Tor
|
||||||
self.c = None
|
self.c = None
|
||||||
|
@ -215,8 +215,8 @@ class Onion(object):
|
||||||
break
|
break
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
# Timeout after 30 seconds
|
# Timeout after 45 seconds
|
||||||
if time.time() - start_ts > 30:
|
if time.time() - start_ts > 45:
|
||||||
print("")
|
print("")
|
||||||
self.tor_proc.terminate()
|
self.tor_proc.terminate()
|
||||||
raise BundledTorTimeout(strings._('settings_error_bundled_tor_timeout'))
|
raise BundledTorTimeout(strings._('settings_error_bundled_tor_timeout'))
|
||||||
|
@ -387,6 +387,9 @@ class Onion(object):
|
||||||
# Stop tor process
|
# Stop tor process
|
||||||
if self.tor_proc:
|
if self.tor_proc:
|
||||||
self.tor_proc.terminate()
|
self.tor_proc.terminate()
|
||||||
|
time.sleep(0.2)
|
||||||
|
if not self.tor_proc.poll():
|
||||||
|
self.tor_proc.kill()
|
||||||
self.tor_proc = None
|
self.tor_proc = None
|
||||||
|
|
||||||
def _get_available_port(self):
|
def _get_available_port(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue