aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:47:41 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:47:41 +1300
commitd938e1e4d8d54fec6aab26246b6b804d34addf66 (patch)
treea861e1320e1402f3c53db631317066d70ab61b50 /src/org/traccar/protocol
parentfbcc3d200aaf25bbe1a6cf30274dd169ecaa8b40 (diff)
downloadtrackermap-server-d938e1e4d8d54fec6aab26246b6b804d34addf66.tar.gz
trackermap-server-d938e1e4d8d54fec6aab26246b6b804d34addf66.tar.bz2
trackermap-server-d938e1e4d8d54fec6aab26246b6b804d34addf66.zip
Modify Wondex frame decoder
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/WondexFrameDecoder.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/WondexFrameDecoder.java b/src/org/traccar/protocol/WondexFrameDecoder.java
index 1a66c9373..eee112e9d 100644
--- a/src/org/traccar/protocol/WondexFrameDecoder.java
+++ b/src/org/traccar/protocol/WondexFrameDecoder.java
@@ -20,6 +20,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.traccar.helper.ChannelBufferTools;
+import org.traccar.helper.StringFinder;
public class WondexFrameDecoder extends FrameDecoder {
@@ -27,9 +28,7 @@ public class WondexFrameDecoder extends FrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx,
- Channel channel,
- ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
if (buf.readableBytes() < KEEP_ALIVE_LENGTH) {
return null;
@@ -45,8 +44,8 @@ public class WondexFrameDecoder extends FrameDecoder {
} else {
- Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), "\r\n");
- if (index != null) {
+ int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("\r\n"));
+ if (index != -1) {
ChannelBuffer frame = buf.readBytes(index - buf.readerIndex());
buf.skipBytes(2);
return frame;