summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-03 22:51:47 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-03 22:51:47 +0200
commit2b3ea917b0a830e3ff4817c7240e0f1808ae58bc (patch)
tree2359f4fca5e51d2b7eb253728f62b74db7da0e69 /src/de/blinkt/openvpn/OpenVpnService.java
parent9cd2069d5d57fc605a8eae3e6f8a0b09b56d4c16 (diff)
parentd3c50d3637462d4e3e3a3c09d43d37ce5656f67a (diff)
Merge Merge try number 2
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index 442fd94c..076fe7b5 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -33,8 +33,6 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
Handler mHandler;
private Thread mServiceThread;
- private ParcelFileDescriptor mInterface;
-
private Vector<String> mDnslist=new Vector<String>();
private VpnProfile mProfile;
@@ -159,12 +157,12 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
if(mgmtsocket!=null) {
// start a Thread that handles incoming messages of the managment socket
- mSocketManager = new OpenVpnManagementThread(mProfile,mgmtsocket);
+ mSocketManager = new OpenVpnManagementThread(mProfile,mgmtsocket,this);
mSocketManagerThread = new Thread(mSocketManager,"OpenVPNMgmtThread");
mSocketManagerThread.start();
}
- return START_STICKY;
+ return START_NOT_STICKY;
}
@@ -191,7 +189,7 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
- public ParcelFileDescriptor openTun() {
+ public int openTun() {
Builder builder = new Builder();
builder.addAddress(mLocalIP.mIp, mLocalIP.len);
@@ -223,8 +221,15 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
Intent intent = new Intent(getBaseContext(),LogWindow.class);
PendingIntent startLW = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
builder.setConfigureIntent(startLW);
- mInterface = builder.establish();
- return mInterface;
+ try {
+ ParcelFileDescriptor pfd = builder.establish();
+ return pfd.detachFd();
+ } catch (Exception e) {
+ OpenVPN.logMessage(0, "", getString(R.string.tun_open_error));
+ OpenVPN.logMessage(0, "", getString(R.string.error) + e.getLocalizedMessage());
+ OpenVPN.logMessage(0, "", getString(R.string.tun_error_helpful));
+ return -1;
+ }
}