commit fbfa2d1d7ac7bb462ebfc1374cc8586a316f6e1f Author: Nathan Freitas nathan@freitas.net Date: Thu Jan 12 21:53:42 2012 -0500
flush iptables immediately when disabled in settings --- .../android/settings/SettingsPreferences.java | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/android/settings/SettingsPreferences.java b/src/org/torproject/android/settings/SettingsPreferences.java index bb5b24b..55134ab 100644 --- a/src/org/torproject/android/settings/SettingsPreferences.java +++ b/src/org/torproject/android/settings/SettingsPreferences.java @@ -5,6 +5,7 @@ package org.torproject.android.settings;
import org.torproject.android.R; import org.torproject.android.R.xml; +import org.torproject.android.TorConstants; import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorTransProxy;
@@ -18,6 +19,7 @@ import android.preference.PreferenceManager; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; +import android.util.Log; import android.widget.Toast;
@@ -145,11 +147,21 @@ public class SettingsPreferences prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked()); prefTransProxyApps.setEnabled(prefCBTransProxy.isChecked() && (!prefcBTransProxyAll.isChecked())); + if (!prefCBTransProxy.isChecked()) + clearTransProxyState (); + } return true; }
- + private void clearTransProxyState () + { + try { + new TorTransProxy().flushIptables(this); + } catch (Exception e) { + Log.e(TorConstants.TAG,"error flushing iptables",e); + } + }
}
tor-commits@lists.torproject.org