Skip to content

Commit

Permalink
Applied coding rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
redboltz committed Nov 27, 2020
1 parent 091098a commit 489cd0a
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions test/test_broker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool compare_topic_filter(MQTT_NS::string_view topic_filter, MQTT_NS::string_vie

if ('+' == topic_filter[idx]) {
// Compare everything up to the first +
if(topic_filter.substr(0, idx) == topic_name.substr(0, idx)) {
if (topic_filter.substr(0, idx) == topic_name.substr(0, idx)) {
/*
* We already know thanks to the topic filter being validated
* that the + symbol is directly touching '/'s on both sides
Expand Down Expand Up @@ -774,7 +774,7 @@ class test_broker {
session_expiry_interval.emplace(std::chrono::seconds(v.value().val()));
}

if(will) {
if (will) {
auto v = get_property<MQTT_NS::v5::property::message_expiry_interval>(will.value().props());
if (v && v.value().val() != 0) {
will_expiry_interval.emplace(std::chrono::seconds(v.value().val()));
Expand Down Expand Up @@ -845,7 +845,7 @@ class test_broker {
seq_idx.modify(seq_idx.begin(), [&](auto &i) {
auto props = MQTT_NS::force_move(i.props);

if(i.tim_message_expiry) {
if (i.tim_message_expiry) {
set_property<MQTT_NS::v5::property::message_expiry_interval>(props,
MQTT_NS::v5::property::message_expiry_interval(static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(
i.tim_message_expiry->expiry() - std::chrono::steady_clock::now()).count())));
Expand Down Expand Up @@ -1048,7 +1048,7 @@ class test_broker {
try {
auto props = MQTT_NS::force_move(session.will().value().props());

if(session.get_tim_will_expiry()) {
if (session.get_tim_will_expiry()) {
set_property<MQTT_NS::v5::property::message_expiry_interval>(props,
MQTT_NS::v5::property::message_expiry_interval(static_cast<uint32_t>(
std::chrono::duration_cast<std::chrono::seconds>(session.get_tim_will_expiry()->expiry() - std::chrono::steady_clock::now()).count())));
Expand Down Expand Up @@ -1643,17 +1643,18 @@ class test_broker {
}
else {
std::shared_ptr<as::steady_timer> tim_message_expiry;
if(message_expiry_interval) {
if (message_expiry_interval) {
tim_message_expiry = std::make_shared<as::steady_timer>(ioc_, message_expiry_interval.value());
tim_message_expiry->async_wait(
[this, topic = topic, wp = std::weak_ptr<as::steady_timer>(tim_message_expiry)]
(boost::system::error_code const& ec) {
if (auto sp = wp.lock()) {
if( ! ec ) {
retains_.erase(topic);
}
}
});
[this, topic = topic, wp = std::weak_ptr<as::steady_timer>(tim_message_expiry)]
(boost::system::error_code const& ec) {
if (auto sp = wp.lock()) {
if (!ec) {
retains_.erase(topic);
}
}
}
);
}

retains_.insert_or_assign(
Expand Down

0 comments on commit 489cd0a

Please sign in to comment.