aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/OsmAndProtocolDecoder.java
diff options
context:
space:
mode:
authorninioe <ninioe@gmail.com>2016-07-24 10:12:29 +0300
committerninioe <ninioe@gmail.com>2016-07-24 10:12:29 +0300
commitefb18afb3bc265e0d3525ad66ee0e0558d95f478 (patch)
treef5d4cc82a144072a8eec0d25f9fb592422285e1f /src/org/traccar/protocol/OsmAndProtocolDecoder.java
parentfd3a695813f511d1b94775bd4e8a4c57053fc66d (diff)
parent0c61dddb5f875e34c819f6d936fcb5e7f45d88ed (diff)
downloadtrackermap-server-efb18afb3bc265e0d3525ad66ee0e0558d95f478.tar.gz
trackermap-server-efb18afb3bc265e0d3525ad66ee0e0558d95f478.tar.bz2
trackermap-server-efb18afb3bc265e0d3525ad66ee0e0558d95f478.zip
Merge remote-tracking branch 'refs/remotes/tananaev/master'
# Conflicts: # tools/test-generator.py
Diffstat (limited to 'src/org/traccar/protocol/OsmAndProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index cfa8990dd..f46511b27 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -16,10 +16,8 @@
package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
@@ -50,8 +48,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri());
Map<String, List<String>> params = decoder.getParameters();
if (params.isEmpty()) {
- decoder = new QueryStringDecoder(
- request.getContent().toString(StandardCharsets.US_ASCII), false);
+ decoder = new QueryStringDecoder(request.getContent().toString(StandardCharsets.US_ASCII), false);
params = decoder.getParameters();
}
@@ -66,6 +63,10 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
case "deviceid":
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, value);
if (deviceSession == null) {
+ if (channel != null) {
+ channel.write(
+ new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.BAD_REQUEST));
+ }
return null;
}
position.setDeviceId(deviceSession.getDeviceId());
@@ -123,9 +124,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
}
if (channel != null) {
- HttpResponse response = new DefaultHttpResponse(
- HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
- channel.write(response).addListener(ChannelFutureListener.CLOSE);
+ channel.write(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK));
}
return position;