commit 232098eeafef79c024a5b255e3de82cb3a8e92b4 Author: Hans-Christoph Steiner hans@eds.org Date: Fri Jun 12 14:49:19 2015 -0400
set STATUS_STARTING in TorService.onCreate(), that's where it begins
The very first place that the whole tor start sequence starts is from TorService's onCreate(), so that is where STATUS_STARTING should be announced from. The open question is whether Intents besides ACTION_START ever cause TorService to start. In theory, TorService should already be running when any Intent is sent besides ACTION_START. --- src/org/torproject/android/service/TorService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index a78769c..f5fe6e1 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -608,7 +608,10 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon @Override public void onCreate() { super.onCreate(); - Log.i("TorService", "onCreate"); + + sendCallbackStatus(STATUS_STARTING); + sendCallbackLogMessage(getString(R.string.status_starting_up)); + logNotice(getString(R.string.status_starting_up));
try { @@ -776,7 +779,8 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon * The entire process for starting tor and related services is run from this method. */ private void startTor() { - if (mCurrentStatus == STATUS_STARTING || mCurrentStatus == STATUS_STOPPING) { + // STATUS_STARTING is set in onCreate() + if (mCurrentStatus == STATUS_STOPPING) { // these states should probably be handled better sendCallbackLogMessage("Ignoring start request, currently " + mCurrentStatus); return; @@ -784,10 +788,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon sendCallbackLogMessage("Ignoring start request, already started."); return; } - - sendCallbackStatus(STATUS_STARTING); - sendCallbackLogMessage(getString(R.string.status_starting_up)); - logNotice(getString(R.string.status_starting_up));
if (findExistingTorDaemon()) { return; // an old tor is already running, nothing to do
tor-commits@lists.torproject.org