[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] fix Shell calls so that we close() shell when done
commit c9bf8d25856e012762382be6491c2016b91c0e93
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date: Tue Apr 8 01:12:56 2014 -0400
fix Shell calls so that we close() shell when done
---
src/org/torproject/android/service/TorService.java | 17 +++++++----------
.../torproject/android/service/TorTransProxy.java | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 23c0a4c..fc49df1 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -434,10 +434,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
}
-
private void killTorProcess () throws Exception
{
- StringBuilder log = new StringBuilder();
int procId = -1;
if (conn != null)
@@ -457,7 +455,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
conn = null;
}
- int killDelayMs = 300;
int maxTry = 5;
int currTry = 0;
@@ -481,7 +478,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{
logNotice("Found Privoxy PID=" + procId + " - killing now...");
-
tb.killAll(filePrivoxy.getCanonicalPath());
}
@@ -489,14 +485,11 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{
logNotice("Found ObfsProxy PID=" + procId + " - killing now...");
-
tb.killAll(fileObfsProxy.getCanonicalPath());
}
}
- else
- {
- throw new Exception("*** Unable to kill existing Tor process. Please REBOOT your device. ***");
- }
+
+ shell.close();
}
private void logNotice (String msg)
@@ -569,6 +562,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
File fileTest = new File(fileBin.getCanonicalPath());
logNotice(fileTest.getName() + ": POST: Is binary exec? " + fileTest.canExecute());
+
+ shell.close();
}
return fileBin.canExecute();
@@ -751,6 +746,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
}
}
+ shell.close();
+
if (procId == -1)
{
@@ -809,7 +806,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
logNotice("Privoxy process id=" + privoxyProcId);
-
+ shell.close();
}
diff --git a/src/org/torproject/android/service/TorTransProxy.java b/src/org/torproject/android/service/TorTransProxy.java
index 931366e..5438d16 100644
--- a/src/org/torproject/android/service/TorTransProxy.java
+++ b/src/org/torproject/android/service/TorTransProxy.java
@@ -393,6 +393,8 @@ public class TorTransProxy implements TorServiceConstants {
fixTransproxyLeak (context);
+ shell.close();
+
return 1;
}
@@ -431,6 +433,8 @@ public class TorTransProxy implements TorServiceConstants {
}
+
+ shell.close();
return 0;
}
@@ -471,7 +475,11 @@ public class TorTransProxy implements TorServiceConstants {
shell.add(cmd);
- return cmd.getExitCode();
+ int exitCode = cmd.getExitCode();
+
+ shell.close();
+
+ return exitCode;
}
public int fixTransproxyLeak (Context context) throws Exception
@@ -490,6 +498,8 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -I OUTPUT ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 -p tcp -m tcp --tcp-flags ACK,RST ACK,RST -j DROP");
shell.add(new SimpleCommand(script.toString()));
+ shell.close();
+
return 1;
}
@@ -642,7 +652,11 @@ public class TorTransProxy implements TorServiceConstants {
fixTransproxyLeak (context);
- return cmd.getExitCode();
+ int exitCode = cmd.getExitCode();
+
+ shell.close();
+
+ return exitCode;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits