aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-06-25 14:54:23 +0500
committerAbyss777 <abyss@fox5.ru>2018-06-25 14:54:23 +0500
commit202da9e249114a30844e69041b32879af3a37b31 (patch)
tree8e8b92c2ec78f602cd7390089422bea938f33279 /src
parent37b76e674f381b3750ba61b3ccfa423ec0c8a2ec (diff)
downloadtrackermap-server-202da9e249114a30844e69041b32879af3a37b31.tar.gz
trackermap-server-202da9e249114a30844e69041b32879af3a37b31.tar.bz2
trackermap-server-202da9e249114a30844e69041b32879af3a37b31.zip
Send queued commands on status online
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/database/ConnectionManager.java8
1 files 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<Event, Position> updateDeviceState(long deviceId) {