summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/blinkt')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
index 5fbb440b..e7576bb5 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
@@ -214,6 +214,7 @@ public class VpnStatus {
}
public interface StateListener {
+ String STATE_CONNECTRETRY = "CONNECTRETRY";
void updateState(String state, String logmessage, int localizedResId, ConnectionStatus level);
void setConnectedVPN(String uuid);
@@ -267,10 +268,12 @@ public class VpnStatus {
public synchronized static void addStateListener(StateListener sl) {
- if (!stateListener.contains(sl)) {
- stateListener.add(sl);
- if (mLaststate != null)
- sl.updateState(mLaststate, mLaststatemsg, mLastStateresid, mLastLevel);
+ synchronized (stateListener) {
+ if (!stateListener.contains(sl)) {
+ stateListener.add(sl);
+ if (mLaststate != null)
+ sl.updateState(mLaststate, mLaststatemsg, mLastStateresid, mLastLevel);
+ }
}
}
@@ -351,7 +354,9 @@ public class VpnStatus {
public synchronized static void removeStateListener(StateListener sl) {
- stateListener.remove(sl);
+ synchronized (stateListener) {
+ stateListener.remove(sl);
+ }
}
@@ -384,8 +389,10 @@ public class VpnStatus {
mLastLevel = level;
- for (StateListener sl : stateListener) {
- sl.updateState(state, msg, resid, level);
+ synchronized (stateListener) {
+ 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)));
}