make tor restart more aggressive as last resort for tor-death bug

master
Kevin Froman 2019-08-11 13:53:38 -05:00
parent 3e99bd3a83
commit 00e2445475
2 changed files with 8 additions and 4 deletions

View File

@ -61,4 +61,4 @@ def handle_daemon_commands(comm_inst):
localcommand.local_command('queueResponseAdd/' + cmd[4], post=True, postData={'data': response})
response = ''
comm_inst.decrementThreadCount('handle_daemon_commands')
comm_inst.decrementThreadCount('handle_daemon_commands')

View File

@ -17,11 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import os, sys, base64, subprocess, signal
import os, sys, base64, subprocess, signal, time
import config, logger
from . import getopenport
from utils import identifyhome
config.reload()
TOR_KILL_WAIT = 3
class NetController:
'''
This class handles hidden service setup on Tor and I2P
@ -179,5 +180,8 @@ HiddenServicePort 80 ''' + self.apiServerIP + ''':''' + str(self.hsPort)
pass
except FileNotFoundError:
pass
return
time.sleep(TOR_KILL_WAIT)
try:
os.kill(int(pidN), signal.SIGKILL)
except (ProcessLookupError, PermissionError) as e:
pass