diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-04-30 02:53:12 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-04-30 02:53:12 +0200 |
commit | 2f73ef1dda56ba7ae588091e0c0e8f71c02bbf32 (patch) | |
tree | 2ec9d7e96aea032153e51aa1ec9df4ce23d9ad10 /src/de/blinkt/openvpn/OpenVPNThread.java | |
parent | daf44e6fbde97e23c9e39f26d1ed0bd3a0f02ede (diff) |
version 0.4.2
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVPNThread.java')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVPNThread.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java new file mode 100644 index 00000000..124179e5 --- /dev/null +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -0,0 +1,61 @@ +package de.blinkt.openvpn;
+
+import java.util.Arrays;
+
+import android.util.Log;
+
+public class OpenVPNThread implements Runnable {
+ private static final String TAG = "OpenVPN";
+ private OpenVpnService mService;
+ private String[] mArgv;
+
+ public OpenVPNThread(OpenVpnService service,String[] argv)
+ {
+ mService = service;
+ mArgv = argv;
+ }
+
+ @Override
+ public void run() {
+ try {
+ Log.i(TAG, "Starting o");
+
+
+ OpenVPN.setCallback(mService);
+
+
+ // We try to create the tunnel for several times. The better way
+ // is to work with ConnectivityManager, such as trying only when
+ // the network is avaiable. Here we just use a counter to keep
+ // things simple.
+ //for (int attempt = 0; attempt < 10; ++attempt) {
+ mService.getHandler().sendEmptyMessage(R.string.connecting);
+
+ // Log argv
+
+ OpenVPN.logMessage(0, "argv:" , Arrays.toString(mArgv));
+
+ OpenVPN.startOpenVPNThreadArgs(mArgv);
+
+
+
+ // Sleep for a while. This also checks if we got interrupted.
+ Thread.sleep(3000);
+ //}
+ Log.i(TAG, "Giving up");
+ } catch (Exception e) {
+ Log.e(TAG, "Got " + e.toString());
+ } finally {
+ try {
+ /// mInterface.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ //mInterface = null;
+
+
+ mService.getHandler().sendEmptyMessage(R.string.disconnected);
+ Log.i(TAG, "Exiting");
+ }
+ }
+}
|