From 202da9e249114a30844e69041b32879af3a37b31 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 25 Jun 2018 14:54:23 +0500 Subject: Send queued commands on status online --- src/org/traccar/database/ConnectionManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index ac60287ae..ef2085295 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -57,9 +57,7 @@ public class ConnectionManager { } public void addActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) { - ActiveDevice activeDevice = new ActiveDevice(deviceId, protocol, channel, remoteAddress); - activeDevices.put(deviceId, activeDevice); - Context.getCommandsManager().sendQueuedCommands(activeDevice); + activeDevices.put(deviceId, new ActiveDevice(deviceId, protocol, channel, remoteAddress)); } public void removeActiveDevice(Channel channel) { @@ -136,6 +134,10 @@ public class ConnectionManager { } updateDevice(device); + + if (status.equals(Device.STATUS_ONLINE) && !oldStatus.equals(Device.STATUS_ONLINE)) { + Context.getCommandsManager().sendQueuedCommands(getActiveDevice(deviceId)); + } } public Map updateDeviceState(long deviceId) { -- cgit v1.2.3