commit 626a341d088588d4090ccb90b03f4e3ac4e908a1 Author: bim dsnake@protonmail.com Date: Sun Dec 13 19:10:01 2020 -0500
stopTor just invokes stopTorAsync so i got rid of it --- .../torproject/android/service/OrbotService.java | 44 ++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java index 04f4f053..10f4a686 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java @@ -292,38 +292,34 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb //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 (useIPtProxy()) - IPtProxy.stopObfs4Proxy(); - - stopTorDaemon(true); + new Thread(() ->{ + Log.i("OrbotService", "stopTor"); + try { + sendCallbackStatus(STATUS_STOPPING); + sendCallbackLogMessage(getString(R.string.status_shutting_down));
- //stop the foreground priority and make sure to remove the persistant notification - stopForeground(true); + if (useIPtProxy()) + IPtProxy.stopObfs4Proxy();
- 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 useIPtProxy () @@ -760,7 +756,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
} 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);
tor-commits@lists.torproject.org