summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-03 22:18:56 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-03 22:18:56 +0200
commitc3e7e4fbab09a55a7e433f76f290be75d77bcb28 (patch)
tree069e25f914563249f15c14e49dc24f11dfd99e9b /src/de/blinkt/openvpn/OpenVpnService.java
parent3d54881bc78b893ab286681338dd7b9b69d871b3 (diff)
add delete Profile support
add Config Parser begin openvpn config => Vpn Profile Converter
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;
+ }
}