summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2017-01-31 11:33:36 +0100
committerArne Schwabe <arne@rfc2549.org>2017-01-31 18:28:38 +0100
commit39f9fffbc600205e2360549bf7a3ca22d60dccbc (patch)
treeead01ef66e388374f04a9533624439825f97c28e /main/src
parentf092c4bf93ff4a373f1f4b01474e1fa69af11dc9 (diff)
Log more state debug information to help debugging reconnecting problems
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java9
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java12
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java2
3 files changed, 13 insertions, 10 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
index f36840f5..4260ea8f 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
@@ -20,6 +20,7 @@ import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;
import java.util.LinkedList;
import java.util.Objects;
+import java.util.StringTokenizer;
import static de.blinkt.openvpn.core.OpenVPNManagement.pauseReason;
@@ -135,7 +136,7 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
@Override
public void onReceive(Context context, Intent intent) {
- SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context);
+ SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context);
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
@@ -173,15 +174,15 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
private void fillTrafficData() {
trafficdata.add(new Datapoint(System.currentTimeMillis(), TRAFFIC_LIMIT));
}
+
public static boolean equalsObj(Object a, Object b) {
return (a == null) ? (b == null) : a.equals(b);
}
-
public void networkStateChange(Context context) {
NetworkInfo networkInfo = getCurrentNetworkInfo(context);
- SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context);
+ SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context);
boolean sendusr1 = prefs.getBoolean("netchangereconnect", true);
@@ -261,6 +262,8 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
if (!netstatestring.equals(lastStateMsg))
VpnStatus.logInfo(R.string.netstatus, netstatestring);
+ VpnStatus.logDebug(String.format("Debug state info: %s, pause: %s, shouldbeconnected: %s, network: %s ",
+ netstatestring, getPauseReason(), shouldBeConnected(), network));
lastStateMsg = netstatestring;
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index c97f804e..22d6a708 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -338,16 +338,16 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
VpnStatus.updateStateString("CONNECTRETRY", String.valueOf(waittime),
R.string.state_waitconnectretry, ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET);
mResumeHandler.postDelayed(mResumeHoldRunnable, waittime * 1000);
- if (waittime > 5) {
+ if (waittime > 5)
VpnStatus.logInfo(R.string.state_waitconnectretry, String.valueOf(waittime));
+ else
+ VpnStatus.logDebug(R.string.state_waitconnectretry, String.valueOf(waittime));
- }
} else {
mWaitingForRelease = true;
VpnStatus.updateStatePause(lastPauseReason);
-
}
}
@@ -566,12 +566,12 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
pw = mProfile.getPasswordPrivateKey();
} else if (needed.equals("Auth")) {
pw = mProfile.getPasswordAuth();
-
+
String usercmd = String.format("username '%s' %s\n",
needed, VpnProfile.openVpnEscape(mProfile.mUsername));
managmentCommand(usercmd);
- }
- if (pw != null) {
+ }
+ if (pw != null) {
String cmd = String.format("password '%s' %s\n", needed, VpnProfile.openVpnEscape(pw));
managmentCommand(cmd);
} else {
diff --git a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
index cd0e3e4f..0c250ad1 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
@@ -375,7 +375,7 @@ public class VpnStatus {
for (StateListener sl : stateListener) {
sl.updateState(state, msg, resid, level);
}
- //newLogItem(new LogItem((LogLevel.DEBUG), String.format("New OpenVPN Status (%s->%s): %s",state,level.toString(),msg)));
+ newLogItem(new LogItem((LogLevel.DEBUG), String.format("New OpenVPN Status (%s->%s): %s",state,level.toString(),msg)));
}
public static void logInfo(String message) {