From edaa07444d1363f3197cbd0f2c56f9ffe1000bf4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 15 Oct 2016 08:31:09 +1300 Subject: Option to ignore session cache (fix #2372) --- debug.xml | 2 ++ src/org/traccar/BaseProtocolDecoder.java | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/debug.xml b/debug.xml index 0b07ed140..58ae764f6 100644 --- a/debug.xml +++ b/debug.xml @@ -43,6 +43,8 @@ true + false + true true true diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index 15f5471e9..f1101567d 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -89,6 +89,17 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { } public DeviceSession getDeviceSession(Channel channel, SocketAddress remoteAddress, String... uniqueIds) { + if (Context.getConfig().getBoolean("decoder.ignoreSessionCache")) { + long deviceId = findDeviceId(remoteAddress, uniqueIds); + if (deviceId != 0) { + if (Context.getConnectionManager() != null) { + Context.getConnectionManager().addActiveDevice(deviceId, protocol, channel, remoteAddress); + } + return new DeviceSession(deviceId); + } else { + return null; + } + } if (channel instanceof DatagramChannel) { long deviceId = findDeviceId(remoteAddress, uniqueIds); DeviceSession deviceSession = addressDeviceSessions.get(remoteAddress); -- cgit v1.2.3