Commit e94ebf05 authored by neverlord's avatar neverlord

fixed forwarding for remote groups

parent 9662ca2e
...@@ -146,23 +146,31 @@ class local_broker : public event_based_actor { ...@@ -146,23 +146,31 @@ class local_broker : public event_based_actor {
} }
}, },
on(atom("FORWARD"), arg_match) >> [=](const any_tuple& what) { on(atom("FORWARD"), arg_match) >> [=](const any_tuple& what) {
// local forwarding
m_group->send_all_subscribers(last_sender().get(), what); m_group->send_all_subscribers(last_sender().get(), what);
// forward to all acquaintances
send_to_acquaintances(what);
}, },
on<atom("DOWN"), std::uint32_t>() >> [=] { on<atom("DOWN"), std::uint32_t>() >> [=] {
actor_ptr other = last_sender(); actor_ptr other = last_sender();
if (other) m_acquaintances.erase(other); if (other) m_acquaintances.erase(other);
}, },
others() >> [=] { others() >> [=] {
auto sender = last_sender().get(); send_to_acquaintances(last_dequeued());
for (auto& acquaintance : m_acquaintances) {
acquaintance->enqueue(sender, last_dequeued());
}
} }
); );
} }
private: private:
void send_to_acquaintances(const any_tuple& what) {
// send to all remote subscribers
auto sender = last_sender().get();
for (auto& acquaintance : m_acquaintances) {
acquaintance->enqueue(sender, what);
}
}
local_group_ptr m_group; local_group_ptr m_group;
std::set<actor_ptr> m_acquaintances; std::set<actor_ptr> m_acquaintances;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment