aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/ConnectionManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-26 00:15:26 +1200
committerGitHub <noreply@github.com>2018-06-26 00:15:26 +1200
commit5346d413972191b3089969e4832bed2ffabbfb83 (patch)
treea7ecece384d0806a5b75b90964419fcb432328b8 /src/org/traccar/database/ConnectionManager.java
parentc6bda91e2434bfd1a3e63df39dca1e78c16a09c1 (diff)
parent202da9e249114a30844e69041b32879af3a37b31 (diff)
downloadtrackermap-server-5346d413972191b3089969e4832bed2ffabbfb83.tar.gz
trackermap-server-5346d413972191b3089969e4832bed2ffabbfb83.tar.bz2
trackermap-server-5346d413972191b3089969e4832bed2ffabbfb83.zip
Merge pull request #3947 from Abyss777/fix_queued
Send queued commands on status online
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-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) {