Skip to content

Commit

Permalink
Merge pull request #2548 from STEllAR-GROUP/fixing_disconnect
Browse files Browse the repository at this point in the history
Fixing issue with disconnect
  • Loading branch information
hkaiser committed Mar 21, 2017
2 parents ebcfb76 + 4417f2f commit e566263
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions hpx/runtime/components/server/runtime_support.hpp
Expand Up @@ -327,6 +327,7 @@ namespace hpx { namespace components { namespace server
bool keep_factory_alive(component_type t);

void remove_here_from_connection_cache();
void remove_here_from_console_connection_cache();

///////////////////////////////////////////////////////////////////////
void register_message_handler(char const* message_handler_type,
Expand Down
30 changes: 29 additions & 1 deletion src/runtime/components/server/runtime_support_server.cpp
Expand Up @@ -1138,7 +1138,6 @@ namespace hpx { namespace components { namespace server

// Drop the locality from the partition table.
naming::gid_type here = agas_client.get_local_locality();
agas_client.unregister_locality(here, ec);

// unregister fixed components
agas_client.unbind_local(appl.get_runtime_support_raw_gid(), ec);
Expand All @@ -1147,6 +1146,11 @@ namespace hpx { namespace components { namespace server
if (remove_from_remote_caches)
remove_here_from_connection_cache();

agas_client.unregister_locality(here, ec);

if (remove_from_remote_caches)
remove_here_from_console_connection_cache();

if (respond_to) {
// respond synchronously
typedef lcos::base_lco_with_value<void> void_lco_type;
Expand Down Expand Up @@ -1416,6 +1420,10 @@ namespace hpx { namespace components { namespace server
action_type act;
for (naming::id_type const& id : locality_ids)
{
// console is handled separately
if (naming::get_locality_id_from_id(id) == 0)
continue;

indirect_packaged_task ipt;
callbacks.push_back(ipt.get_future());
apply_cb(act, id, std::move(ipt), hpx::get_locality(), rt->endpoints());
Expand All @@ -1424,6 +1432,26 @@ namespace hpx { namespace components { namespace server
wait_all(callbacks);
}

void runtime_support::remove_here_from_console_connection_cache()
{
runtime* rt = get_runtime_ptr();
if (rt == nullptr)
return;

typedef server::runtime_support::remove_from_connection_cache_action
action_type;

action_type act;
indirect_packaged_task ipt;
future<void> callback = ipt.get_future();

// handle console separately
id_type id = naming::get_id_from_locality_id(0);
apply_cb(act, id, std::move(ipt), hpx::get_locality(), rt->endpoints());

callback.wait();
}

///////////////////////////////////////////////////////////////////////////
void runtime_support::register_message_handler(
char const* message_handler_type, char const* action, error_code& ec)
Expand Down

0 comments on commit e566263

Please sign in to comment.