diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-01 15:49:16 +1000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-01 15:49:16 +1000 |
commit | e177e7d083a4dd3f64172802661bf658d26d1163 (patch) | |
tree | a1e4a90e9a2fce3db8bc51981aeb8a23cced5e6d /src/org/traccar/protocol | |
parent | cd0c04a03b359dfc5b1ea3f61b93aaae8f6fec3e (diff) | |
download | traccar-server-e177e7d083a4dd3f64172802661bf658d26d1163.tar.gz traccar-server-e177e7d083a4dd3f64172802661bf658d26d1163.tar.bz2 traccar-server-e177e7d083a4dd3f64172802661bf658d26d1163.zip |
Check OsmAnd messages for device id
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/OsmAndProtocolDecoder.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index f9f04d7e3..c5884a4d0 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -73,9 +73,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { case "deviceid": DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, value); if (deviceSession == null) { - if (channel != null) { - sendResponse(channel, HttpResponseStatus.BAD_REQUEST); - } + sendResponse(channel, HttpResponseStatus.BAD_REQUEST); return null; } position.setDeviceId(deviceSession.getDeviceId()); @@ -132,11 +130,14 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { position.setTime(new Date()); } - if (channel != null) { + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); + if (deviceSession != null) { sendResponse(channel, HttpResponseStatus.OK); + return position; + } else { + sendResponse(channel, HttpResponseStatus.BAD_REQUEST); + return null; } - - return position; } } |