Skip to content

Commit

Permalink
Send queued commands on status online
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyss777 committed Jun 25, 2018
1 parent 37b76e6 commit 202da9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/org/traccar/database/ConnectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public 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) {
Expand Down Expand Up @@ -136,6 +134,10 @@ public void run(Timeout timeout) {
}

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) {
Expand Down

0 comments on commit 202da9e

Please sign in to comment.