aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-13 17:31:52 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-13 17:31:52 -0700
commita8e38b74e5fc6789676bf35a9b92594a230e3ad8 (patch)
treeeed89969aecd7c9652f8640742530c96a4fc40b3 /src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
parent33733f835e88a62c4a5259ab330723b88037adf1 (diff)
downloadtrackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.tar.gz
trackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.tar.bz2
trackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.zip
Avoid broadcast loops (fix #4894)
Diffstat (limited to 'src/main/java/org/traccar/broadcast/MulticastBroadcastService.java')
-rw-r--r--src/main/java/org/traccar/broadcast/MulticastBroadcastService.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
index be24989dd..3eafe07d3 100644
--- a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
+++ b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
@@ -98,7 +98,7 @@ public class MulticastBroadcastService implements BroadcastService {
}
@Override
- public void invalidateObject(Class<? extends BaseModel> clazz, long id) {
+ public void invalidateObject(boolean local, Class<? extends BaseModel> clazz, long id) {
BroadcastMessage message = new BroadcastMessage();
message.setChanges(Map.of(Permission.getKey(clazz), id));
sendMessage(message);
@@ -106,6 +106,7 @@ public class MulticastBroadcastService implements BroadcastService {
@Override
public void invalidatePermission(
+ boolean local,
Class<? extends BaseModel> clazz1, long id1,
Class<? extends BaseModel> clazz2, long id2) {
BroadcastMessage message = new BroadcastMessage();
@@ -137,10 +138,12 @@ public class MulticastBroadcastService implements BroadcastService {
if (iterator.hasNext()) {
var second = iterator.next();
listeners.forEach(listener -> listener.invalidatePermission(
+ false,
Permission.getKeyClass(first.getKey()), first.getValue(),
Permission.getKeyClass(second.getKey()), second.getValue()));
} else {
listeners.forEach(listener -> listener.invalidateObject(
+ false,
Permission.getKeyClass(first.getKey()), first.getValue()));
}
}