[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] make start and stop of Tor service all hanlded through executor
commit 2125db1504a075a62cf9b301071f3e723dc59f24
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date: Fri Oct 21 14:53:58 2016 -0400
make start and stop of Tor service all hanlded through executor
---
app/src/main/java/org/torproject/android/OnBootReceiver.java | 3 +--
.../src/main/java/org/torproject/android/service/TorService.java | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OnBootReceiver.java b/app/src/main/java/org/torproject/android/OnBootReceiver.java
index 722f4f1..f915a20 100644
--- a/app/src/main/java/org/torproject/android/OnBootReceiver.java
+++ b/app/src/main/java/org/torproject/android/OnBootReceiver.java
@@ -41,8 +41,7 @@ public class OnBootReceiver extends BroadcastReceiver {
Intent torService = new Intent(context, TorService.class);
torService.setAction(action);
context.startService(torService);
-
-
+
}
diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
index 5cd3e75..e4faeb5 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
@@ -109,8 +109,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
- private ExecutorService mExecutor = Executors.newFixedThreadPool(1);
-
+ private ExecutorService mExecutor = Executors.newFixedThreadPool(3);
TorEventHandler mEventHandler;
@@ -296,7 +295,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
*/
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null)
- new Thread (new IncomingIntentRouter(intent)).start();
+ exec (new IncomingIntentRouter(intent));
else
Log.d(OrbotConstants.TAG, "Got null onStartCommand() intent");
@@ -363,13 +362,14 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
private void stopTor ()
{
- mExecutor.execute(new Runnable ()
+ exec(new Runnable ()
{
public void run ()
{
stopTorAsync();
}
});
+
}
private void stopTorAsync () {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits