aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-01 12:01:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-01 12:01:40 +1200
commit61c54f16cf75d33923fc18b6abcee843f523dec2 (patch)
tree9e0b0fc1426ce262942bcd34dfc332777e32e03a /src/org/traccar/database
parent362fb75ec0ff6f6c615f07abde917cb55da4de5c (diff)
downloadtrackermap-server-61c54f16cf75d33923fc18b6abcee843f523dec2.tar.gz
trackermap-server-61c54f16cf75d33923fc18b6abcee843f523dec2.tar.bz2
trackermap-server-61c54f16cf75d33923fc18b6abcee843f523dec2.zip
Remove disconnected devices from active
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/ConnectionManager.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java
index 39ec465e6..1aa0dbc57 100644
--- a/src/org/traccar/database/ConnectionManager.java
+++ b/src/org/traccar/database/ConnectionManager.java
@@ -50,6 +50,15 @@ public class ConnectionManager {
public void setActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) {
activeDevices.put(deviceId, new ActiveDevice(deviceId, protocol, channel, remoteAddress));
}
+
+ public void removeActiveDevice(Channel channel) {
+ for (ActiveDevice activeDevice : activeDevices.values()) {
+ if (activeDevice.getChannel() == channel) {
+ activeDevices.remove(activeDevice.getDeviceId());
+ break;
+ }
+ }
+ }
public ActiveDevice getActiveDevice(long deviceId) {
return activeDevices.get(deviceId);