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