diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-20 23:16:33 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-20 23:16:33 +1300 |
commit | 0bf2902297a5f48019675790df60353a27ad80d3 (patch) | |
tree | 7232a13a32dece7f341ad007158d73781209e8fd /src/org/traccar/database/ConnectionManager.java | |
parent | f5d309d193d1549d29314310b9c2a7bf0caf42af (diff) | |
parent | 91da9fa8e53836e71c36609132c38797317ae9e1 (diff) | |
download | trackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.tar.gz trackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.tar.bz2 trackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.zip |
Merge pull request #3589 from Abyss777/buffered_commands
Implement buffered/delayed 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)); |