Skip to content

Commit

Permalink
Merge branch 'master' of github.com:guardianproject/orbot
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Dec 14, 2020
2 parents 47b7b80 + 626a341 commit 9be60c2
Showing 1 changed file with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,41 +292,40 @@ public void onDestroy() {
//not registered yet
}

stopTor();
stopTorAsync();

super.onDestroy();
}

private void stopTor() {
new Thread(this::stopTorAsync).start();
}

private void stopTorAsync() {
Log.i("OrbotService", "stopTor");
try {
sendCallbackStatus(STATUS_STOPPING);
sendCallbackLogMessage(getString(R.string.status_shutting_down));

if (useIPtObfsMeekProxy())
IPtProxy.stopObfs4Proxy();
new Thread(() ->{
Log.i("OrbotService", "stopTor");
try {
sendCallbackStatus(STATUS_STOPPING);
sendCallbackLogMessage(getString(R.string.status_shutting_down));

if (useIPtSnowflakeProxy())
IPtProxy.stopSnowflake();
if (useIPtObfsMeekProxy())
IPtProxy.stopObfs4Proxy();

stopTorDaemon(true);
if (useIPtSnowflakeProxy())
IPtProxy.stopSnowflake();

//stop the foreground priority and make sure to remove the persistant notification
stopForeground(true);

sendCallbackLogMessage(getString(R.string.status_disabled));
} catch (Exception e) {
logNotice("An error occured stopping Tor: " + e.getMessage());
sendCallbackLogMessage(getString(R.string.something_bad_happened));
}
clearNotifications();
sendCallbackStatus(STATUS_OFF);
stopTorDaemon(true);

//stop the foreground priority and make sure to remove the persistant notification
stopForeground(true);

sendCallbackLogMessage(getString(R.string.status_disabled));
} catch (Exception e) {
logNotice("An error occured stopping Tor: " + e.getMessage());
sendCallbackLogMessage(getString(R.string.something_bad_happened));
}
clearNotifications();
sendCallbackStatus(STATUS_OFF);
}).start();
}

private static boolean useIPtObfsMeekProxy ()
Expand Down Expand Up @@ -775,7 +774,7 @@ private void startTor() {

} catch (Exception e) {
logException("Unable to start Tor: " + e.toString(), e);
stopTor();
stopTorAsync();
showToolbarNotification(
getString(R.string.unable_to_start_tor) + ": " + e.getMessage(),
ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr);
Expand Down

0 comments on commit 9be60c2

Please sign in to comment.