Spreaded the validation of fixed flags
This commit is contained in:
@@ -16,7 +16,7 @@ class ConnAckDecoder extends DemuxDecoder {
|
|||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
//Common decoding part
|
//Common decoding part
|
||||||
ConnAckMessage message = new ConnAckMessage();
|
ConnAckMessage message = new ConnAckMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ConnectDecoder extends DemuxDecoder {
|
|||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
//Common decoding part
|
//Common decoding part
|
||||||
ConnectMessage message = new ConnectMessage();
|
ConnectMessage message = new ConnectMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ class DisconnectDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
DisconnectMessage message = new DisconnectMessage();
|
DisconnectMessage message = new DisconnectMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class MessageIDDecoder extends DemuxDecoder {
|
|||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
//Common decoding part
|
//Common decoding part
|
||||||
MessageIDMessage message = createMessage();
|
MessageIDMessage message = createMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class PingReqDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
PingReqMessage message = new PingReqMessage();
|
PingReqMessage message = new PingReqMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class PingRespDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
PingRespMessage message = new PingRespMessage();
|
PingRespMessage message = new PingRespMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ package org.dna.mqtt.moquette.parser.netty;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.CorruptedFrameException;
|
|
||||||
import io.netty.util.AttributeMap;
|
import io.netty.util.AttributeMap;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SubAckDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
SubAckMessage message = new SubAckMessage();
|
SubAckMessage message = new SubAckMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x00, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,10 @@ class SubscribeDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
SubscribeMessage message = new SubscribeMessage();
|
SubscribeMessage message = new SubscribeMessage();
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x02, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO check reserved fixed flags = b0010
|
|
||||||
|
|
||||||
//check qos level
|
//check qos level
|
||||||
if (message.getQos() != QOSType.LEAST_ONE) {
|
if (message.getQos() != QOSType.LEAST_ONE) {
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ class UnsubscribeDecoder extends DemuxDecoder {
|
|||||||
//Common decoding part
|
//Common decoding part
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
UnsubscribeMessage message = new UnsubscribeMessage();
|
UnsubscribeMessage message = new UnsubscribeMessage();
|
||||||
if (!decodeCommonHeader(message, in)) {
|
if (!decodeCommonHeader(message, 0x02, in)) {
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user