diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-08-08 00:37:54 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-08-08 00:37:54 +0200 |
commit | 294ea3e986d7d6726d5bf6f913c47ce9a966c7ee (patch) | |
tree | f1616aa42ea58c39304268b2d7fd3ad53e645b59 /src/de/blinkt/openvpn/OpenVpnManagementThread.java | |
parent | 2ccb2f792b601198536a8da765c61d15385a4eaf (diff) |
Use management-client and management-signal (closes issue #65)
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnManagementThread.java')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnManagementThread.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index 7a0beb1d..3f0d8439 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -18,6 +18,7 @@ import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
+import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.os.Build;
import android.os.ParcelFileDescriptor;
@@ -34,16 +35,17 @@ public class OpenVpnManagementThread implements Runnable { private int mBytecountinterval=2;
private long mLastIn=0;
private long mLastOut=0;
- private String mCurrentstate;
+ private String mCurrentstate;
+ private LocalServerSocket mServerSocket;
private static Vector<OpenVpnManagementThread> active=new Vector<OpenVpnManagementThread>();
static private native void jniclose(int fdint);
static private native byte[] rsasign(byte[] input,int pkey) throws InvalidKeyException;
- public OpenVpnManagementThread(VpnProfile profile, LocalSocket mgmtsocket, OpenVpnService openVpnService) {
+ public OpenVpnManagementThread(VpnProfile profile, LocalServerSocket mgmtsocket, OpenVpnService openVpnService) {
mProfile = profile;
- mSocket = mgmtsocket;
+ mServerSocket = mgmtsocket;
mOpenVPNService = openVpnService;
}
@@ -67,16 +69,14 @@ public class OpenVpnManagementThread implements Runnable { Log.i(TAG, "Managment Socket Thread started");
byte [] buffer =new byte[2048];
// mSocket.setSoTimeout(5); // Setting a timeout cannot be that bad
- InputStream instream = null;
- try {
- instream = mSocket.getInputStream();
- } catch (IOException e) {
- e.printStackTrace();
- }
+
String pendingInput="";
active.add(this);
try {
+ // Wait for a client to connect
+ mSocket= mServerSocket.accept();
+ InputStream instream = mSocket.getInputStream();
while(true) {
int numbytesread = instream.read(buffer);
|