clarify vpnprotect code and add basic debug log

This commit is contained in:
Nathan Freitas 2015-02-02 16:20:26 -05:00
parent ede4128777
commit 4c49822861
1 changed files with 13 additions and 10 deletions

View File

@ -12,11 +12,11 @@ import java.net.InetSocketAddress;
import java.net.NoRouteToHostException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import android.annotation.SuppressLint;
import android.net.VpnService;
import android.util.Log;
import com.runjva.sourceforge.jsocks.server.ServerAuthenticator;
@ -352,7 +352,6 @@ public class ProxyServer implements Runnable {
Socket s;
if (proxy == null) {
//s = new Socket(msg.ip, msg.port);
s = SocketChannel.open().socket();
if ((null != s) && (null != vpnService)) {
@ -363,10 +362,11 @@ public class ProxyServer implements Runnable {
} else {
s = new SocksSocket(proxy, msg.ip, msg.port);
}
if (vpnService != null)
vpnService.protect(s);
}
debug("Connected to " + s.getInetAddress() + ":" + s.getPort());
@ -667,26 +667,29 @@ public class ProxyServer implements Runnable {
public static void debug (String msg)
{
Log.d("Proxy",msg);
}
public static void debug (String msg, String host, int port)
{
debug (msg);
}
public static void debug (String msg, Exception e)
{
debug (msg);
}
public static void debug (String msg, InetAddress addr, int port)
{
debug (msg);
}
public static void debug (String msg, int type, String log)
{
debug (msg);
}
}