summaryrefslogtreecommitdiff
path: root/app/src/main/java/de
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-12-07 16:50:41 +0100
committercyBerta <cyberta@riseup.net>2018-12-07 16:50:41 +0100
commit9b832c4386f0f839006df68dd75d98fc173344d0 (patch)
tree378cfcb2e03885f786f41ffb04aef0eaf0d971a3 /app/src/main/java/de
parent1f5095b59c93b04120a2e10f0b083b4f6846ca68 (diff)
first shot gatewayselection
Diffstat (limited to 'app/src/main/java/de')
-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)));
}