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.
This commit is contained in:
parent
8f57b42e68
commit
232098eeaf
|
@ -608,7 +608,10 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.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
|
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.
|
* The entire process for starting tor and related services is run from this method.
|
||||||
*/
|
*/
|
||||||
private void startTor() {
|
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
|
// these states should probably be handled better
|
||||||
sendCallbackLogMessage("Ignoring start request, currently " + mCurrentStatus);
|
sendCallbackLogMessage("Ignoring start request, currently " + mCurrentStatus);
|
||||||
return;
|
return;
|
||||||
|
@ -785,10 +789,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCallbackStatus(STATUS_STARTING);
|
|
||||||
sendCallbackLogMessage(getString(R.string.status_starting_up));
|
|
||||||
logNotice(getString(R.string.status_starting_up));
|
|
||||||
|
|
||||||
if (findExistingTorDaemon()) {
|
if (findExistingTorDaemon()) {
|
||||||
return; // an old tor is already running, nothing to do
|
return; // an old tor is already running, nothing to do
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue