mirror of
https://github.com/moparisthebest/SSLDroid
synced 2024-11-27 03:12:18 -05:00
Fixed shutdown issue and some error handling adjustments
Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
parent
2ebebbd896
commit
c1a7c94be9
@ -24,35 +24,6 @@ public class TcpProxy {
|
|||||||
public TcpProxy() {
|
public TcpProxy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public TcpProxy(int listenPort, String tunnelHost, int tunnelPort,
|
|
||||||
String keyFile, String keyPass) {
|
|
||||||
this.listenPort = listenPort;
|
|
||||||
this.tunnelHost = tunnelHost;
|
|
||||||
this.tunnelPort = tunnelPort;
|
|
||||||
this.keyFile = keyFile;
|
|
||||||
this.keyPass = keyPass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getListenPort() {
|
|
||||||
return listenPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTunnelHost() {
|
|
||||||
return tunnelHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTunnelPort() {
|
|
||||||
return tunnelPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeyFile() {
|
|
||||||
return keyFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeyPass() {
|
|
||||||
return keyPass;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public void createNotification(String title, String text) {
|
public void createNotification(String title, String text) {
|
||||||
try {
|
try {
|
||||||
FileWriter outFile = new FileWriter("/mnt/sdcard/ssldroid.txt");
|
FileWriter outFile = new FileWriter("/mnt/sdcard/ssldroid.txt");
|
||||||
@ -66,20 +37,13 @@ public class TcpProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serve(int listenPort, String tunnelHost, int tunnelPort,
|
public void serve(int listenPort, String tunnelHost, int tunnelPort, String keyFile, String keyPass) throws IOException {
|
||||||
String keyFile, String keyPass) throws IOException {
|
|
||||||
//final TcpProxy ttg = new TcpProxy(listenPort, tunnelHost, tunnelPort,keyFile, keyPass);
|
|
||||||
// create the server thread
|
|
||||||
try {
|
try {
|
||||||
ss = new ServerSocket(listenPort);
|
ss = new ServerSocket(listenPort);
|
||||||
Log.d("SSLDroid", "Listening for connections on port "
|
Log.d("SSLDroid", "Listening for connections on port "
|
||||||
+ listenPort + " ...");
|
+ listenPort + " ...");
|
||||||
//ttg.doLog("Listening for connections on port " + ttg.getListenPort() + " ...");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d("SSLDroid", "Error setting up listening socket: "
|
Log.d("SSLDroid", "Error setting up listening socket: " + e.toString());
|
||||||
+ e.toString());
|
|
||||||
//createNotification(e.getMessage(), "Error setting up listening socket: "+e.toString());
|
|
||||||
//e.printStackTrace();
|
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
server = new TcpProxyServerThread(ss, listenPort, tunnelHost, tunnelPort, keyFile, keyPass);
|
server = new TcpProxyServerThread(ss, listenPort, tunnelHost, tunnelPort, keyFile, keyPass);
|
||||||
|
@ -193,10 +193,10 @@ public class TcpProxyServerThread extends Thread {
|
|||||||
((SSLSocket) st).startHandshake();
|
((SSLSocket) st).startHandshake();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d("SSLDroid", "SSL failure: " + e.toString());
|
Log.d("SSLDroid", "SSL failure: " + e.toString());
|
||||||
//createNotification(e.getMessage(), "SSL failure: "+e.toString());
|
//Thread.sleep(10000);
|
||||||
Thread.sleep(10000);
|
//continue;
|
||||||
continue;
|
sc.close();
|
||||||
//st = new Socket(ttg.getTunnelHost(), ttg.getTunnelPort());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d("SSLDroid", "Tunnelling port "
|
Log.d("SSLDroid", "Tunnelling port "
|
||||||
|
Loading…
Reference in New Issue
Block a user