aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/DmtProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-10 10:55:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-10 10:55:06 +1200
commit1dc1e06cfd4b7b23775984a254723b2d06b4f1dd (patch)
tree6dd89b120a7400ff3f08b2cb213cadc27112d0e7 /src/org/traccar/protocol/DmtProtocolDecoder.java
parent58a222ba3d546dc2366586f2c904e70680a394bd (diff)
downloadtrackermap-server-1dc1e06cfd4b7b23775984a254723b2d06b4f1dd.tar.gz
trackermap-server-1dc1e06cfd4b7b23775984a254723b2d06b4f1dd.tar.bz2
trackermap-server-1dc1e06cfd4b7b23775984a254723b2d06b4f1dd.zip
Handle buffers reference count
Diffstat (limited to 'src/org/traccar/protocol/DmtProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/DmtProtocolDecoder.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/DmtProtocolDecoder.java b/src/org/traccar/protocol/DmtProtocolDecoder.java
index 637b9f9ca..613b8cddd 100644
--- a/src/org/traccar/protocol/DmtProtocolDecoder.java
+++ b/src/org/traccar/protocol/DmtProtocolDecoder.java
@@ -58,6 +58,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
response.writeShortLE(content != null ? content.readableBytes() : 0);
if (content != null) {
response.writeBytes(content);
+ content.release();
}
channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
@@ -244,7 +245,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
DeviceSession deviceSession = getDeviceSession(
channel, remoteAddress, buf.readSlice(15).toString(StandardCharsets.US_ASCII));
- ByteBuf response = Unpooled.buffer(); // TODO ref count
+ ByteBuf response = Unpooled.buffer();
if (length == 51) {
response.writeByte(0); // reserved
response.writeIntLE(0); // reserved
@@ -257,13 +258,13 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
} else if (type == MSG_COMMIT) {
- ByteBuf response = Unpooled.buffer(0); // TODO ref count
+ ByteBuf response = Unpooled.buffer(0);
response.writeByte(1); // flags (success)
sendResponse(channel, MSG_COMMIT_RESPONSE, response);
} else if (type == MSG_CANNED_REQUEST_1) {
- ByteBuf response = Unpooled.buffer(0); // TODO ref count
+ ByteBuf response = Unpooled.buffer(0);
response.writeBytes(new byte[12]);
sendResponse(channel, MSG_CANNED_RESPONSE_1, response);