aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-15 15:46:27 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-15 15:46:27 -0700
commit6adcd4a8dd950a5f945c818280974a0302c9fd8b (patch)
tree4505b5b683f1a9ac32419f945622f17b26f3cc70
parentf9257e664be8c37cc041e004f403d737dd513d6b (diff)
downloadtrackermap-server-6adcd4a8dd950a5f945c818280974a0302c9fd8b.tar.gz
trackermap-server-6adcd4a8dd950a5f945c818280974a0302c9fd8b.tar.bz2
trackermap-server-6adcd4a8dd950a5f945c818280974a0302c9fd8b.zip
Remove duplication
-rw-r--r--src/main/java/org/traccar/BaseProtocolDecoder.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolDecoder.java b/src/main/java/org/traccar/BaseProtocolDecoder.java
index 634ceafd5..d014b0871 100644
--- a/src/main/java/org/traccar/BaseProtocolDecoder.java
+++ b/src/main/java/org/traccar/BaseProtocolDecoder.java
@@ -233,16 +233,18 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
}
}
}
+ long deviceId = 0;
if (position != null) {
- connectionManager.updateDevice(
- position.getDeviceId(), Device.STATUS_ONLINE, new Date());
+ deviceId = position.getDeviceId();
} else {
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
if (deviceSession != null) {
- connectionManager.updateDevice(
- deviceSession.getDeviceId(), Device.STATUS_ONLINE, new Date());
+ deviceId = deviceSession.getDeviceId();
}
}
+ if (deviceId > 0) {
+ connectionManager.updateDevice(deviceId, Device.STATUS_ONLINE, new Date());
+ }
}
@Override