You need to sign in before continuing.
Commit 44de6670380a6030719f95efc18b4b7c36d26644
1 parent
756289d4
Make recursive publish methods static
They don't need object state.
Showing
2 changed files
with
6 additions
and
6 deletions
subscriptionstore.cpp
| ... | ... | @@ -383,7 +383,7 @@ void SubscriptionStore::queueWillMessage(const std::shared_ptr<WillPublish> &wil |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | void SubscriptionStore::publishNonRecursively(const std::unordered_map<std::string, Subscription> &subscribers, |
| 386 | - std::forward_list<ReceivingSubscriber> &targetSessions) const | |
| 386 | + std::forward_list<ReceivingSubscriber> &targetSessions) | |
| 387 | 387 | { |
| 388 | 388 | for (auto &pair : subscribers) |
| 389 | 389 | { |
| ... | ... | @@ -410,7 +410,7 @@ void SubscriptionStore::publishNonRecursively(const std::unordered_map<std::stri |
| 410 | 410 | * look at objdump --disassemble --demangle to see how many calls (not jumps) to itself are made and compare. |
| 411 | 411 | */ |
| 412 | 412 | void SubscriptionStore::publishRecursively(std::vector<std::string>::const_iterator cur_subtopic_it, std::vector<std::string>::const_iterator end, |
| 413 | - SubscriptionNode *this_node, std::forward_list<ReceivingSubscriber> &targetSessions) const | |
| 413 | + SubscriptionNode *this_node, std::forward_list<ReceivingSubscriber> &targetSessions) | |
| 414 | 414 | { |
| 415 | 415 | if (cur_subtopic_it == end) // This is the end of the topic path, so look for subscribers here. |
| 416 | 416 | { | ... | ... |
subscriptionstore.h
| ... | ... | @@ -125,10 +125,10 @@ class SubscriptionStore |
| 125 | 125 | |
| 126 | 126 | Logger *logger = Logger::getInstance(); |
| 127 | 127 | |
| 128 | - void publishNonRecursively(const std::unordered_map<std::string, Subscription> &subscribers, | |
| 129 | - std::forward_list<ReceivingSubscriber> &targetSessions) const; | |
| 130 | - void publishRecursively(std::vector<std::string>::const_iterator cur_subtopic_it, std::vector<std::string>::const_iterator end, | |
| 131 | - SubscriptionNode *this_node, std::forward_list<ReceivingSubscriber> &targetSessions) const; | |
| 128 | + static void publishNonRecursively(const std::unordered_map<std::string, Subscription> &subscribers, | |
| 129 | + std::forward_list<ReceivingSubscriber> &targetSessions); | |
| 130 | + static void publishRecursively(std::vector<std::string>::const_iterator cur_subtopic_it, std::vector<std::string>::const_iterator end, | |
| 131 | + SubscriptionNode *this_node, std::forward_list<ReceivingSubscriber> &targetSessions); | |
| 132 | 132 | void giveClientRetainedMessagesRecursively(std::vector<std::string>::const_iterator cur_subtopic_it, |
| 133 | 133 | std::vector<std::string>::const_iterator end, RetainedMessageNode *this_node, bool poundMode, |
| 134 | 134 | std::forward_list<Publish> &packetList) const; | ... | ... |