aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/broadcast/MulticastBroadcastService.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
index c4ba0e059..be24989dd 100644
--- a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
+++ b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
@@ -167,8 +167,10 @@ public class MulticastBroadcastService implements BroadcastService {
while (!service.isShutdown()) {
DatagramPacket packet = new DatagramPacket(receiverBuffer, receiverBuffer.length);
socket.receive(packet);
- String data = new String(packet.getData(), 0, packet.getLength(), StandardCharsets.UTF_8);
- handleMessage(objectMapper.readValue(data, BroadcastMessage.class));
+ if (networkInterface.inetAddresses().noneMatch(a -> a.equals(packet.getAddress()))) {
+ String data = new String(packet.getData(), 0, packet.getLength(), StandardCharsets.UTF_8);
+ handleMessage(objectMapper.readValue(data, BroadcastMessage.class));
+ }
}
publisherSocket = null;
socket.leaveGroup(group, networkInterface);