aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-15 08:31:09 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-10-15 08:31:09 +1300
commitedaa07444d1363f3197cbd0f2c56f9ffe1000bf4 (patch)
tree2bcc142888dc889c011a5ebcccb6105a924491d8 /src/org/traccar/BaseProtocolDecoder.java
parent974fccb9b808f2ff615f9c9e04f3b722301d2ace (diff)
downloadtrackermap-server-edaa07444d1363f3197cbd0f2c56f9ffe1000bf4.tar.gz
trackermap-server-edaa07444d1363f3197cbd0f2c56f9ffe1000bf4.tar.bz2
trackermap-server-edaa07444d1363f3197cbd0f2c56f9ffe1000bf4.zip
Option to ignore session cache (fix #2372)
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java11
1 files changed, 11 insertions, 0 deletions
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);