Commit af7d77b6 authored by Dominik Charousset's avatar Dominik Charousset

Add reuse flag to publish_local_groups, close #526

parent dfea8b59
......@@ -82,7 +82,8 @@ public:
/// @returns The actual port the OS uses after `bind()`. If `port == 0`
/// the OS chooses a random high-level port.
expected<uint16_t> publish_local_groups(uint16_t port,
const char* in = nullptr);
const char* in = nullptr,
bool reuse = false);
/// Unpublishes `whom` by closing `port` or all assigned ports if `port == 0`.
/// @param whom Actor that should be unpublished at `port`.
......
......@@ -153,7 +153,7 @@ expected<uint16_t> middleman::publish(const strong_actor_ptr& whom,
}
expected<uint16_t> middleman::publish_local_groups(uint16_t port,
const char* in) {
const char* in, bool reuse) {
CAF_LOG_TRACE(CAF_ARG(port) << CAF_ARG(in));
auto group_nameserver = [](event_based_actor* self) -> behavior {
return {
......@@ -163,7 +163,7 @@ expected<uint16_t> middleman::publish_local_groups(uint16_t port,
};
};
auto gn = system().spawn<hidden>(group_nameserver);
auto result = publish(gn, port, in);
auto result = publish(gn, port, in, reuse);
// link gn to our manager
if (result)
manager_->add_link(actor_cast<abstract_actor*>(gn));
......
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