don't kill Tor process and make sure service is sticky

This commit is contained in:
Nathan Freitas 2014-06-24 10:06:11 -04:00
parent 8b6cff0dc0
commit 247e2ed86d
1 changed files with 6 additions and 6 deletions

View File

@ -268,7 +268,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{ {
new startTorOperation().execute(intent); new startTorOperation().execute(intent);
return Service.START_NOT_STICKY; return Service.START_STICKY;
} }
catch (Exception e) catch (Exception e)
@ -469,9 +469,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
conn = null; conn = null;
} }
killProcess(fileTor); // killProcess(fileTor);
killProcess(filePolipo); killProcess(filePolipo);
killProcess(fileObfsclient); // killProcess(fileObfsclient);
} }
@ -484,7 +484,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
while ((procId = TorServiceUtils.findProcessId(fileProcBin.getCanonicalPath())) != -1) while ((procId = TorServiceUtils.findProcessId(fileProcBin.getCanonicalPath())) != -1)
{ {
logNotice("Found fileObfsclient PID=" + procId + " - killing now..."); logNotice("Found " + fileProcBin.getName() + " PID=" + procId + " - killing now...");
SimpleCommand killCommand = new SimpleCommand("toolbox kill " + procId); SimpleCommand killCommand = new SimpleCommand("toolbox kill " + procId);
shell.add(killCommand); shell.add(killCommand);
@ -582,8 +582,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (!fileBin.canExecute()) if (!fileBin.canExecute())
{ {
logNotice("(re)Setting permission on binary: " + fileBin.getCanonicalPath()); logNotice("(re)Setting permission on binary: " + fileBin.getCanonicalPath());
Shell shell = Shell.startShell(new ArrayList<String>(), appBinHome.getCanonicalPath()); //Shell shell = Shell.startShell(new ArrayList<String>(), appBinHome.getCanonicalPath());
Shell shell = Shell.startShell();
shell.add(new SimpleCommand("chmod " + CHMOD_EXE_VALUE + ' ' + fileBin.getCanonicalPath())).waitForFinish(); shell.add(new SimpleCommand("chmod " + CHMOD_EXE_VALUE + ' ' + fileBin.getCanonicalPath())).waitForFinish();
File fileTest = new File(fileBin.getCanonicalPath()); File fileTest = new File(fileBin.getCanonicalPath());