diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-20 18:44:48 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-20 18:44:48 +1200 |
commit | 6f0bcdc18a8b0060c9842497045a9358f0920957 (patch) | |
tree | 9feab54b03918c3918cdeb0369ddaea89e44cc9c /src/org/traccar/DetectorHandler.java | |
parent | 6e96a50ef39415556439a2726f34c4932ab74eb9 (diff) | |
download | trackermap-server-6f0bcdc18a8b0060c9842497045a9358f0920957.tar.gz trackermap-server-6f0bcdc18a8b0060c9842497045a9358f0920957.tar.bz2 trackermap-server-6f0bcdc18a8b0060c9842497045a9358f0920957.zip |
Hide failed matches by default
Diffstat (limited to 'src/org/traccar/DetectorHandler.java')
-rw-r--r-- | src/org/traccar/DetectorHandler.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/org/traccar/DetectorHandler.java b/src/org/traccar/DetectorHandler.java index 0f94235c0..d764412e5 100644 --- a/src/org/traccar/DetectorHandler.java +++ b/src/org/traccar/DetectorHandler.java @@ -18,14 +18,8 @@ package org.traccar; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.*; import org.jboss.netty.handler.codec.frame.FrameDecoder; -import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; -import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler; -import org.jboss.netty.handler.timeout.IdleStateEvent; -import org.traccar.database.DataManager; -import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; -import org.traccar.model.Position; import java.lang.reflect.Method; import java.net.SocketAddress; @@ -34,12 +28,14 @@ import java.util.List; public class DetectorHandler extends SimpleChannelHandler { private List<TrackerServer> serverList; + + private boolean showFailed; DetectorHandler(List<TrackerServer> serverList) { this.serverList = serverList; } - public static void checkPipeline(String protocol, ChannelPipeline pipeline, ChannelBuffer buf) throws Exception { + public void checkPipeline(String protocol, ChannelPipeline pipeline, ChannelBuffer buf) throws Exception { Object tmp = buf.duplicate(); // Frame decoder @@ -88,10 +84,8 @@ public class DetectorHandler extends SimpleChannelHandler { if (tmp != null) { Log.info("Protocol " + protocol + " possible match"); - System.out.println("Protocol " + protocol + " possible match"); - } else { + } else if (showFailed) { Log.info("Protocol " + protocol + " no match"); - System.out.println("Protocol " + protocol + " no match"); } } @@ -107,8 +101,9 @@ public class DetectorHandler extends SimpleChannelHandler { checkPipeline(server.getProtocol(), server.getPipelineFactory().getPipeline(), buf); } } catch(Exception error) { - Log.info("Protocol " + server.getProtocol() + " error"); - System.out.println("Protocol " + server.getProtocol() + " error"); + if (showFailed) { + Log.info("Protocol " + server.getProtocol() + " error"); + } } } } |