[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] make sure to kill existing pdnsd, and set the new ports properly



commit e146f703254bae36c2f9535595d71d97ef963bce
Author: n8fr8 <nathan@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri Aug 2 10:26:33 2019 -0400

    make sure to kill existing pdnsd, and set the new ports properly
---
 .../android/service/vpn/OrbotVpnManager.java       | 27 ++++++++++++++++------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
index c843c183..65db4659 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
@@ -144,15 +144,19 @@ public class OrbotVpnManager implements Handler.Callback {
 			{
 				Log.d(TAG,"starting OrbotVPNService service!");
 
-				mTorSocks = intent.getIntExtra(TorService.EXTRA_SOCKS_PROXY_PORT,-1);
-				mTorDns = intent.getIntExtra(TorService.EXTRA_DNS_PORT,-1);
+				int newTorSocks = intent.getIntExtra(TorService.EXTRA_SOCKS_PROXY_PORT,-1);
+				int newTorDns = intent.getIntExtra(TorService.EXTRA_DNS_PORT,-1);
 
-				if (!mIsLollipop)
-				{
-					startSocksBypass();
-				}
+				if ((mTorSocks != newTorSocks || mTorDns != newTorDns)) {
+					mTorSocks = newTorSocks;
+					mTorDns = newTorDns;
+
+					if (!mIsLollipop) {
+						startSocksBypass();
+					}
 
-				setupTun2Socks(builder);
+					setupTun2Socks(builder);
+				}
 			}
 
     	}
@@ -424,6 +428,14 @@ public class OrbotVpnManager implements Handler.Callback {
 
     private boolean stopDns ()
 	{
+
+		// if that fails, try again using native utils
+		try {
+			killProcess(filePdnsd, "-1"); // this is -HUP
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
 		File filePid = new File(mService.getFilesDir(),"pdnsd.pid");
 		String pid = null;
 
@@ -443,6 +455,7 @@ public class OrbotVpnManager implements Handler.Callback {
 			}
 		}
 
+
 		return false;
 
 	}



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits