[tor-commits] [orbot/master] clarify vpnprotect code and add basic debug log

n8fr8 at torproject.org n8fr8 at torproject.org
Fri Apr 3 17:04:05 UTC 2015


commit 4c49822861e746b0c47c79afe288cb9a5349e187
Author: Nathan Freitas <nathan at freitas.net>
Date:   Mon Feb 2 16:20:26 2015 -0500

    clarify vpnprotect code and add basic debug log
---
 .../sourceforge/jsocks/protocol/ProxyServer.java   |   23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/com/runjva/sourceforge/jsocks/protocol/ProxyServer.java b/src/com/runjva/sourceforge/jsocks/protocol/ProxyServer.java
index 739feb8..44f7a50 100644
--- a/src/com/runjva/sourceforge/jsocks/protocol/ProxyServer.java
+++ b/src/com/runjva/sourceforge/jsocks/protocol/ProxyServer.java
@@ -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,9 +352,8 @@ public class ProxyServer implements Runnable {
 		Socket s;
 
 		if (proxy == null) {
-			//s = new Socket(msg.ip, msg.port);
 			
-			s= SocketChannel.open().socket();
+			s = SocketChannel.open().socket();
 			if ((null != s) && (null != vpnService)) {
 			    vpnService.protect(s);
 			}
@@ -363,10 +362,11 @@ public class ProxyServer implements Runnable {
 			
 		} else {
 			s = new SocksSocket(proxy, msg.ip, msg.port);
+
+			if (vpnService != null)
+				vpnService.protect(s);
 		}
 
-		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);
 	}
 }





More information about the tor-commits mailing list