aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-01 15:49:16 +1000
committerAnton Tananaev <anton.tananaev@gmail.com>2016-08-01 15:49:16 +1000
commite177e7d083a4dd3f64172802661bf658d26d1163 (patch)
treea1e4a90e9a2fce3db8bc51981aeb8a23cced5e6d /src/org/traccar
parentcd0c04a03b359dfc5b1ea3f61b93aaae8f6fec3e (diff)
downloadtrackermap-server-e177e7d083a4dd3f64172802661bf658d26d1163.tar.gz
trackermap-server-e177e7d083a4dd3f64172802661bf658d26d1163.tar.bz2
trackermap-server-e177e7d083a4dd3f64172802661bf658d26d1163.zip
Check OsmAnd messages for device id
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java13
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;
}
}