diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-05-27 17:55:01 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-05-27 17:55:01 -0700 |
commit | 961015781071a240c2e4f9c7c5a33a4bfaafd168 (patch) | |
tree | 2d0e230afdec6d9b3885e234b222658d3c57dcd5 /src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java | |
parent | 2dd2aa777540ad08937943dec16925969f93c51a (diff) | |
download | trackermap-server-961015781071a240c2e4f9c7c5a33a4bfaafd168.tar.gz trackermap-server-961015781071a240c2e4f9c7c5a33a4bfaafd168.tar.bz2 trackermap-server-961015781071a240c2e4f9c7c5a33a4bfaafd168.zip |
Skip keep alive message
Diffstat (limited to 'src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java index 4d4d79d8d..c30fee6e3 100644 --- a/src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java +++ b/src/main/java/org/traccar/protocol/TeltonikaFrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +29,14 @@ public class TeltonikaFrameDecoder extends BaseFrameDecoder { protected Object decode( ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { - // Check minimum length + while (buf.isReadable() && buf.getByte(buf.readerIndex()) == (byte) 0xff) { + buf.skipBytes(1); + } + if (buf.readableBytes() < MESSAGE_MINIMUM_LENGTH) { return null; } - // Read packet int length = buf.getUnsignedShort(buf.readerIndex()); if (length > 0) { if (buf.readableBytes() >= (length + 2)) { |