blob: 124179e568db46198680a49663014e80d359c883 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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");
}
}
}
|