1.增加包长度的校验,后续要改掉此常量。

This commit is contained in:
wusheng 2015-12-23 14:08:09 +08:00
parent 0573841923
commit 45729c9853
1 changed files with 3 additions and 1 deletions

View File

@ -4,13 +4,15 @@ import com.ai.cloud.skywalking.reciever.buffer.DataBufferThreadContainer;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import static com.ai.cloud.skywalking.reciever.conf.Config.Persistence.*;
public class CollectionServerDataHandler extends SimpleChannelInboundHandler<byte[]> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, byte[] msg) throws Exception {
Thread.currentThread().setName("ServerReceiver");
// 当接受到这条消息的是空则忽略
if (msg != null && msg.length >= 0) {
if (msg != null && msg.length >= 0 && msg.length < MAX_STORAGE_SIZE_PER_TIME) {
DataBufferThreadContainer.getDataBufferThread().saveTemporarily(msg);
}
}