small tweaks to Tor binary startup code

This commit is contained in:
Nathan Freitas 2014-04-15 00:25:28 -04:00
parent 16799ef0c6
commit cc020f54b6
1 changed files with 12 additions and 4 deletions

View File

@ -734,16 +734,24 @@ public class TorService extends Service implements TorServiceConstants, TorConst
int torRetryWaitTimeMS = 1000; int torRetryWaitTimeMS = 1000;
ArrayList<String> alEnv = new ArrayList<String>();
alEnv.add("HOME=" + appBinHome.getAbsolutePath());
sendCallbackStatusMessage(getString(R.string.status_starting_up)); sendCallbackStatusMessage(getString(R.string.status_starting_up));
//start Tor in the background
ArrayList<String> alEnv = new ArrayList<String>();
alEnv.add("HOME=" + appBinHome.getAbsolutePath());
Shell shell = Shell.startShell(alEnv,appBinHome.getAbsolutePath()); Shell shell = Shell.startShell(alEnv,appBinHome.getAbsolutePath());
SimpleCommand cmdTor = new SimpleCommand(fileTor.getAbsolutePath() + " DataDirectory " + appCacheHome.getAbsolutePath() + " -f " + torrcPath + "&"); SimpleCommand cmdTor = new SimpleCommand(fileTor.getAbsolutePath() + " DataDirectory " + appCacheHome.getAbsolutePath() + " -f " + torrcPath + " &");
shell.add(cmdTor); shell.add(cmdTor);
if (TorService.ENABLE_DEBUG_LOG)
{
logNotice("Tor exit code=" + cmdTor.getExitCode() + ";output=" + cmdTor.getOutput());
}
//wait a few seconds
Thread.sleep(torRetryWaitTimeMS); Thread.sleep(torRetryWaitTimeMS);
//now try to connect
procId = initControlConnection (); procId = initControlConnection ();
shell.close(); shell.close();