Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refined online and offline sessions and subscribers. #678

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

redboltz
Copy link
Owner

online and offline subscribers has common member function deliver.
It is a preparation for cross collection roundrobin iteration for shared
subscriptions in the future.

Apply coding rules.

Renamed types and variables.

Refined logs.

online and offline subscribers has common member function `deliver`.
It is a preparation for cross collection roundrobin iteration for shared
subscriptions in the future.

Apply coding rules.

Renamed types and variables.

Refined logs.
@codecov
Copy link

codecov bot commented Oct 13, 2020

Codecov Report

Merging #678 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #678      +/-   ##
==========================================
- Coverage   82.69%   82.67%   -0.02%     
==========================================
  Files          46       46              
  Lines        7077     7078       +1     
==========================================
  Hits         5852     5852              
- Misses       1225     1226       +1     

@redboltz redboltz merged commit 6bff955 into master Oct 13, 2020
@redboltz redboltz deleted the refine_online_offline_sessions branch October 13, 2020 09:19
@@ -122,7 +122,7 @@ BOOST_LOG_ATTRIBUTE_KEYWORD(address, "MqttAddress", void const*)

#if !defined(MQTT_ADD_VALUE)

#define MQTT_ADD_VALUE(name, val) boost::log::add_value((name), (val))
#define MQTT_ADD_VALUE(name, val) boost::log::add_value((MQTT_NS::name), (val))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you added MQTT_NS:: to "name" ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some of the log code below, this has a strange outcome.

MQTT_ADD_VALUE(address, spep.get()) -> boost::log::add_value(MQTT_NS::address, spep.get())

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto add_or_overwrite_sub =
[&](MQTT_NS::buffer topic, MQTT_NS::qos qos_value, MQTT_NS::rap rap_value = MQTT_NS::rap::dont) {
auto& idx = subs_online_.get<tag_con_topic>();
auto r = idx.equal_range(std::make_tuple(spep, topic));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of equal_range, use idx.find(std::make_tuple(spep, topic)).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is for emplace_hint.

@@ -839,6 +846,37 @@ class test_broker {

auto& ep = *spep;

std::vector<bool> new_sub;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend making a member variable, so that after the broker has been online for a while, it doesn't have to do new allocations every time.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is temporary variable. SUBSCRIBE packet has multiple entries. It is very small number basically. new_sub marks which entry is new one. I believe that it is better for temporary variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants