Skip to content

Commit

Permalink
Also reuse publish between MQTT3.1 and MQTT 3.1.1 publisher/subscriber
Browse files Browse the repository at this point in the history
This is essentially a fixup of a commit 6373657.
  • Loading branch information
halfgaar committed Nov 17, 2024
1 parent 6a13b3c commit 2c4500f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FlashMQTests/tst_maintests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ void MainTests::testbufferToMqttPacketsFuzz()

void testDowngradeQoSOnSubscribeHelper(const uint8_t pub_qos, const uint8_t sub_qos)
{
std::vector<ProtocolVersion> protocols {ProtocolVersion::Mqtt311, ProtocolVersion::Mqtt5};
std::vector<ProtocolVersion> protocols {ProtocolVersion::Mqtt31, ProtocolVersion::Mqtt311, ProtocolVersion::Mqtt5};

for (const ProtocolVersion senderVersion : protocols)
{
Expand Down
2 changes: 1 addition & 1 deletion publishcopyfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MqttPacket *PublishCopyFactory::getOptimumPacket(

// Note that this cache also possibly contains the expiration interval, but because we're only hitting this block for on-line
// publishers, the interval has not decreased and is fine.
const int cache_key = (static_cast<uint8_t>(protocolVersion) * 10) + static_cast<bool>(actualQos);
const int cache_key = (getPublishLayoutCompareKey(protocolVersion) * 10) + static_cast<bool>(actualQos);
std::optional<MqttPacket> &cachedPack = constructedPacketCache[cache_key];

if (!cachedPack)
Expand Down

0 comments on commit 2c4500f

Please sign in to comment.