Repository navigation
MQTT 3.1.1 implementation - #582
Conversation
jfallows
left a comment
There was a problem hiding this comment.
Please use separate decodeXXXvN methods instead of switch statement to decode all versions in same decodeXXX method.
There was a problem hiding this comment.
We need separate decodePacketTypeV4 and decodePacketTypeV5 decoders.
Then decodeInitialType should decode the generic connect fields to extract the version and switch to the either decodePacketTypeV4 or decodePacketTypeV5.
There should be no need to keep checking the version in decodePacketTypeXX methods.
Suggest having an Int2ObjectHashMap<MqttServerDecoder> from version to decodePacketTypeXX methods.
Then at the end of a decodeXXX method that is identical for both versions, instead of setting the decoder to decodePacketType you can set it to decodePacketTypeByVersion.get(server.version) instead.
For decodeXXX methods that are version specific, they can set the next decoder to decodePacketTypeV4 or decodePacketTypeV5 explicitly.
jfallows
left a comment
There was a problem hiding this comment.
Still need to apply decodePacketTypeVx feedback.
No description provided.