aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/broadcast
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-25 14:17:00 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-25 14:17:00 -0700
commit2fcffc5b55f59310d289a21d1ebc2ee6bf15bcd5 (patch)
tree89b881064fbd3ed3d258c183273a6d23ebd56a0f /src/main/java/org/traccar/broadcast
parentc53d98c668af9c79767e22964f05c7bf7dc866f2 (diff)
downloadtrackermap-server-2fcffc5b55f59310d289a21d1ebc2ee6bf15bcd5.tar.gz
trackermap-server-2fcffc5b55f59310d289a21d1ebc2ee6bf15bcd5.tar.bz2
trackermap-server-2fcffc5b55f59310d289a21d1ebc2ee6bf15bcd5.zip
Fix connection users issue
Diffstat (limited to 'src/main/java/org/traccar/broadcast')
-rw-r--r--src/main/java/org/traccar/broadcast/BroadcastInterface.java6
-rw-r--r--src/main/java/org/traccar/broadcast/MulticastBroadcastService.java12
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/broadcast/BroadcastInterface.java b/src/main/java/org/traccar/broadcast/BroadcastInterface.java
index d5b49f213..69e610dc6 100644
--- a/src/main/java/org/traccar/broadcast/BroadcastInterface.java
+++ b/src/main/java/org/traccar/broadcast/BroadcastInterface.java
@@ -22,13 +22,13 @@ import org.traccar.model.Position;
public interface BroadcastInterface {
- default void updateDevice(Device device) {
+ default void updateDevice(boolean local, Device device) {
}
- default void updatePosition(Position position) {
+ default void updatePosition(boolean local, Position position) {
}
- default void updateEvent(long userId, Event event) {
+ default void updateEvent(boolean local, long userId, Event event) {
}
default void invalidateObject(Class<? extends BaseModel> clazz, long id) {
diff --git a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
index 0525fa742..ac0fcbd86 100644
--- a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
+++ b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
@@ -66,21 +66,21 @@ public class MulticastBroadcastService implements BroadcastService {
}
@Override
- public void updateDevice(Device device) {
+ public void updateDevice(boolean local, Device device) {
BroadcastMessage message = new BroadcastMessage();
message.setDevice(device);
sendMessage(message);
}
@Override
- public void updatePosition(Position position) {
+ public void updatePosition(boolean local, Position position) {
BroadcastMessage message = new BroadcastMessage();
message.setPosition(position);
sendMessage(message);
}
@Override
- public void updateEvent(long userId, Event event) {
+ public void updateEvent(boolean local, long userId, Event event) {
BroadcastMessage message = new BroadcastMessage();
message.setUserId(userId);
message.setEvent(event);
@@ -115,11 +115,11 @@ public class MulticastBroadcastService implements BroadcastService {
private void handleMessage(BroadcastMessage message) {
if (message.getDevice() != null) {
- listeners.forEach(listener -> listener.updateDevice(message.getDevice()));
+ listeners.forEach(listener -> listener.updateDevice(false, message.getDevice()));
} else if (message.getPosition() != null) {
- listeners.forEach(listener -> listener.updatePosition(message.getPosition()));
+ listeners.forEach(listener -> listener.updatePosition(false, message.getPosition()));
} else if (message.getUserId() != null && message.getEvent() != null) {
- listeners.forEach(listener -> listener.updateEvent(message.getUserId(), message.getEvent()));
+ listeners.forEach(listener -> listener.updateEvent(false, message.getUserId(), message.getEvent()));
} else if (message.getChanges() != null) {
var iterator = message.getChanges().entrySet().iterator();
if (iterator.hasNext()) {