Skip to content

Commit 24983e4

Browse files
committed
Mqtt3
1 parent 55e1715 commit 24983e4

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/main/java/com/hivemq/codec/decoder/MQTTMessageDecoder.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,23 +150,13 @@ protected void decode(
150150
//this is the message size HiveMQ allows for incoming messages
151151
if (packetSize > mqttConfig.maxPacketSize()) {
152152
//connack with PACKET_TOO_LARGE for Mqtt5
153-
final ProtocolVersion protocolVersion = connectDecoder.decodeProtocolVersion(clientConnectionContext, buf);
154-
if (protocolVersion == ProtocolVersion.MQTTv5) {
155-
mqttConnacker.connackError(clientConnectionContext.getChannel(),
156-
"A client (IP: {}) connect packet exceeded the maximum permissible size.",
157-
"Sent CONNECT exceeded the maximum permissible size",
158-
Mqtt5ConnAckReasonCode.PACKET_TOO_LARGE,
159-
ReasonStrings.CONNACK_PACKET_TOO_LARGE);
160-
} else { //force channel close for Mqtt3.1 and Mqtt3.1.1
161-
mqttServerDisconnector.disconnect(clientConnectionContext.getChannel(),
162-
"A client (IP: {}) sent a message, that was bigger than the maximum message size. Disconnecting client.",
163-
"Sent a message that was bigger than the maximum size",
164-
Mqtt5DisconnectReasonCode.PACKET_TOO_LARGE,
165-
ReasonStrings.DISCONNECT_PACKET_TOO_LARGE_MESSAGE,
166-
Mqtt5UserProperties.NO_USER_PROPERTIES,
167-
false,
168-
true);
169-
}
153+
connectDecoder.decodeProtocolVersion(clientConnectionContext, buf);
154+
mqttConnacker.connackError(clientConnectionContext.getChannel(),
155+
"A client (ID: {}, IP: {}) connect packet exceeded the maximum permissible size.",
156+
"Sent CONNECT exceeded the maximum permissible size",
157+
Mqtt5ConnAckReasonCode.PACKET_TOO_LARGE,
158+
ReasonStrings.CONNACK_PACKET_TOO_LARGE);
159+
170160
return null;
171161
}
172162

0 commit comments

Comments
 (0)