diff options
author | Abyss777 <abyss@fox5.ru> | 2017-10-19 10:03:02 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-10-19 10:03:02 +0500 |
commit | a2f215fe63bd313bfac2a894c170673ccbc252c4 (patch) | |
tree | 2fa849c58b91133a4c3335e72477561f45152d9d /src/org/traccar/database/ConnectionManager.java | |
parent | 3f5a5e81fe08c7ae0b136d52b4840d5085e12f23 (diff) | |
download | trackermap-server-a2f215fe63bd313bfac2a894c170673ccbc252c4.tar.gz trackermap-server-a2f215fe63bd313bfac2a894c170673ccbc252c4.tar.bz2 trackermap-server-a2f215fe63bd313bfac2a894c170673ccbc252c4.zip |
Implement buffered commands
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-rw-r--r-- | src/org/traccar/database/ConnectionManager.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index de11db21b..e5a7a272f 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -57,7 +57,9 @@ public class ConnectionManager { } public void addActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) { - activeDevices.put(deviceId, new ActiveDevice(deviceId, protocol, channel, remoteAddress)); + ActiveDevice activeDevice = new ActiveDevice(deviceId, protocol, channel, remoteAddress); + activeDevices.put(deviceId, activeDevice); + Context.getCommandsManager().sendQueuedCommands(activeDevice); } public void removeActiveDevice(Channel channel) { @@ -122,6 +124,7 @@ public class ConnectionManager { public void run(Timeout timeout) throws Exception { if (!timeout.isCancelled()) { updateDevice(deviceId, Device.STATUS_UNKNOWN, null); + activeDevices.remove(deviceId); } } }, deviceTimeout, TimeUnit.MILLISECONDS)); |