diff options
Diffstat (limited to 'src/main/java/org/traccar/BaseProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/BaseProtocolDecoder.java | 10 |
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 |