fixes to ensure service does not block

This commit is contained in:
Nathan Freitas 2014-04-17 10:16:56 -04:00
parent ae906d00ac
commit 5551c59e50
1 changed files with 5 additions and 8 deletions

View File

@ -738,6 +738,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
String torrcPath = new File(appBinHome, TORRC_ASSET_KEY).getAbsolutePath(); String torrcPath = new File(appBinHome, TORRC_ASSET_KEY).getAbsolutePath();
// if (ENABLE_DEBUG_LOG)
// torrcPath = new File(appBinHome, TORRCDIAG_ASSET_KEY).getAbsolutePath();
boolean transProxyTethering = prefs.getBoolean("pref_transparent_tethering", false); boolean transProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
if (transProxyTethering) if (transProxyTethering)
@ -745,7 +748,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
torrcPath = new File(appBinHome, TORRC_TETHER_KEY).getAbsolutePath(); torrcPath = new File(appBinHome, TORRC_TETHER_KEY).getAbsolutePath();
} }
int procId = -1; int procId = -1;
int torRetryWaitTimeMS = 1000; int torRetryWaitTimeMS = 1000;
@ -759,11 +761,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
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 //wait a few seconds
Thread.sleep(torRetryWaitTimeMS); Thread.sleep(torRetryWaitTimeMS);
@ -1393,7 +1390,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} }
catch (IOException ioe){ catch (IOException ioe){
logMessage("error requesting newny: " + ioe.getLocalizedMessage()); logMessage("error requesting newnym: " + ioe.getLocalizedMessage());
} }
} }
}.start(); }.start();
@ -1502,7 +1499,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} }
private synchronized void sendCallbackLogMessage (String logMessage) private void sendCallbackLogMessage (String logMessage)
{ {
if (mCallbacks == null) if (mCallbacks == null)