Skip to content

Commit

Permalink
Merge pull request #249 from redboltz/replace_assert_with_ow
Browse files Browse the repository at this point in the history
Replaced BOOST_ASSERT with overwrite.
  • Loading branch information
redboltz authored May 8, 2019
2 parents a29da19 + e54f2e4 commit 58d6681
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion include/mqtt/endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10172,7 +10172,24 @@ class endpoint : public std::enable_shared_from_this<endpoint<Socket, Mutex, Loc
control_packet_type::pubcomp,
msg
);
BOOST_ASSERT(ret.second);
// publish store is erased when pubrec is received.
// pubrel store is erased when pubcomp is received.
// If invalid client send pubrec twice with the same packet id,
// then send corresponding pubrel twice is a possible client/server
// implementation.
// In this case, overwrite store_.
if (!ret.second) {
store_.modify(
ret.first,
[&] (auto& e) {
e = store(
packet_id,
control_packet_type::pubcomp,
msg
);
}
);
}
}

if (serialize) {
Expand Down

0 comments on commit 58d6681

Please sign in to comment.