aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 15:51:11 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 15:51:11 +1200
commit5cf987a9e9cab3e9ec3d2a8acc335a85f2637df0 (patch)
treee290b09c50900b4700ac244827c337ff0fc3450c /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parentc40928cd674144fa5ed3dc7306c33b16823b2fad (diff)
downloadtrackermap-server-5cf987a9e9cab3e9ec3d2a8acc335a85f2637df0.tar.gz
trackermap-server-5cf987a9e9cab3e9ec3d2a8acc335a85f2637df0.tar.bz2
trackermap-server-5cf987a9e9cab3e9ec3d2a8acc335a85f2637df0.zip
Fix various issues
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 6813ffcfe..752168233 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -189,7 +189,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
ByteBuf buf = Unpooled.buffer(
- 2 + 2 + id.readableBytes() + 2 + msg.readableBytes() + 2 + 2);
+ 2 + 2 + id.readableBytes() + 2 + msg.readableBytes() + 2 + 2); // TODO ref count
buf.writeByte('@');
buf.writeByte('@');
@@ -400,29 +400,28 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
buf.readShort(); // length
ByteBuf id = buf.readSlice(7);
int command = buf.readUnsignedShort();
- ByteBuf response;
if (command == MSG_LOGIN) {
- response = Unpooled.wrappedBuffer(new byte[]{0x01});
+ ByteBuf response = Unpooled.wrappedBuffer(new byte[]{0x01});
sendResponse(channel, remoteAddress, id, MSG_LOGIN_RESPONSE, response);
return null;
} else if (command == MSG_HEARTBEAT) {
- response = Unpooled.wrappedBuffer(new byte[]{0x01});
+ ByteBuf response = Unpooled.wrappedBuffer(new byte[]{0x01});
sendResponse(channel, remoteAddress, id, MSG_HEARTBEAT, response);
return null;
} else if (command == MSG_SERVER) {
- response = Unpooled.copiedBuffer(getServer(channel), StandardCharsets.US_ASCII);
+ ByteBuf response = Unpooled.copiedBuffer(getServer(channel), StandardCharsets.US_ASCII);
sendResponse(channel, remoteAddress, id, MSG_SERVER, response);
return null;
} else if (command == MSG_UPLOAD_PHOTO) {
byte imageIndex = buf.readByte();
photos.put(imageIndex, Unpooled.buffer());
- response = Unpooled.copiedBuffer(new byte[]{imageIndex});
+ ByteBuf response = Unpooled.copiedBuffer(new byte[]{imageIndex});
sendResponse(channel, remoteAddress, id, MSG_UPLOAD_PHOTO_RESPONSE, response);
return null;
} else if (command == MSG_UPLOAD_COMPLETE) {
byte imageIndex = buf.readByte();
- response = Unpooled.copiedBuffer(new byte[]{imageIndex, 0, 0});
+ ByteBuf response = Unpooled.copiedBuffer(new byte[]{imageIndex, 0, 0});
sendResponse(channel, remoteAddress, id, MSG_RETRANSMISSION, response);
return null;
}