1
0
mirror of https://github.com/moparisthebest/SSLDroid synced 2024-11-30 04:42:17 -05:00

Fixed shutdown issue and some error handling adjustments

Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
Balint Kovacs 2011-04-15 08:42:03 +02:00
parent 2ebebbd896
commit c1a7c94be9
2 changed files with 6 additions and 42 deletions

View File

@ -24,35 +24,6 @@ public class 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) {
try {
FileWriter outFile = new FileWriter("/mnt/sdcard/ssldroid.txt");
@ -66,20 +37,13 @@ public class TcpProxy {
}
}
public void serve(int listenPort, String tunnelHost, int tunnelPort,
String keyFile, String keyPass) throws IOException {
//final TcpProxy ttg = new TcpProxy(listenPort, tunnelHost, tunnelPort,keyFile, keyPass);
// create the server thread
public void serve(int listenPort, String tunnelHost, int tunnelPort, String keyFile, String keyPass) throws IOException {
try {
ss = new ServerSocket(listenPort);
Log.d("SSLDroid", "Listening for connections on port "
+ listenPort + " ...");
//ttg.doLog("Listening for connections on port " + ttg.getListenPort() + " ...");
} catch (Exception e) {
Log.d("SSLDroid", "Error setting up listening socket: "
+ e.toString());
//createNotification(e.getMessage(), "Error setting up listening socket: "+e.toString());
//e.printStackTrace();
Log.d("SSLDroid", "Error setting up listening socket: " + e.toString());
System.exit(1);
}
server = new TcpProxyServerThread(ss, listenPort, tunnelHost, tunnelPort, keyFile, keyPass);

View File

@ -193,10 +193,10 @@ public class TcpProxyServerThread extends Thread {
((SSLSocket) st).startHandshake();
} catch (Exception e) {
Log.d("SSLDroid", "SSL failure: " + e.toString());
//createNotification(e.getMessage(), "SSL failure: "+e.toString());
Thread.sleep(10000);
continue;
//st = new Socket(ttg.getTunnelHost(), ttg.getTunnelPort());
//Thread.sleep(10000);
//continue;
sc.close();
return;
}
Log.d("SSLDroid", "Tunnelling port "