Skip to content

Commit

Permalink
Merge pull request #1562 from STEllAR-GROUP/message_handler_config
Browse files Browse the repository at this point in the history
Adding configuration option disabling/enabling all message handlers
  • Loading branch information
hkaiser committed Jun 2, 2015
2 parents 03c3d98 + 8a3cbb2 commit 77e24f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/manual/config_defaults.qbk
Expand Up @@ -235,6 +235,7 @@ sections, one for each component.
zero_copy_optimization = ${HPX_PARCEL_ZERO_COPY_OPTIMIZATION:$[hpx.parcel.array_optimization]}
async_serialization = ${HPX_PARCEL_ASYNC_SERIALIZATION:1}
enable_security = ${HPX_PARCEL_ENABLE_SECURITY:0}
message_handlers = ${HPX_PARCEL_MESSAGE_HANDLERS:0}
``
[c++]

Expand Down Expand Up @@ -288,6 +289,9 @@ sections, one for each component.
[[`hpx.parcel.enable_security`]
[This property defines whether this locality is encrypting parcels. The
default is `0`.]]
[[`hpx.parcel.message_handlers`]
[This property defines whether message handlers are loaded. The
default is `0`.]]
]

The following settings relate to the TCP/IP parcelport.
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/parcelset/parcelhandler.hpp
Expand Up @@ -506,6 +506,7 @@ namespace hpx { namespace parcelset
/// Store message handlers for actions
mutex_type handlers_mtx_;
message_handler_map handlers_;
bool const load_message_handlers_;

/// Count number of (outbound) parcels routed
boost::atomic<boost::int64_t> count_routed_;
Expand Down
24 changes: 16 additions & 8 deletions src/runtime/parcelset/parcelhandler.cpp
Expand Up @@ -103,6 +103,9 @@ namespace hpx { namespace parcelset
parcels_(policy),
use_alternative_parcelports_(false),
enable_parcel_handling_(true),
load_message_handlers_(
util::get_entry_as<int>(cfg, "hpx.parcel.message_handlers", "0") != 0
),
count_routed_(0),
write_handler_(&parcelhandler::default_write_handler)
{
Expand Down Expand Up @@ -424,8 +427,8 @@ namespace hpx { namespace parcelset

// If we were able to resolve the address(es) locally we send the
// parcel directly to the destination.
if (resolved_locally) {

if (resolved_locally)
{
// re-wrap the given parcel-sent handler
using util::placeholders::_1;
write_handler_type wrapped_f =
Expand All @@ -435,12 +438,16 @@ namespace hpx { namespace parcelset
// encapsulated action
typedef std::pair<boost::shared_ptr<parcelport>, locality> destination_pair;
destination_pair dest = find_appropriate_destination(addrs[0].locality_);
policies::message_handler* mh =
p.get_message_handler(this, dest.second);

if (mh) {
mh->put_parcel(dest.second, p, wrapped_f);
return;
if (load_message_handlers_)
{
policies::message_handler* mh =
p.get_message_handler(this, dest.second);

if (mh) {
mh->put_parcel(dest.second, p, wrapped_f);
return;
}
}

dest.first->put_parcel(dest.second, p, wrapped_f);
Expand Down Expand Up @@ -1183,7 +1190,8 @@ namespace hpx { namespace parcelset
"zero_copy_optimization = ${HPX_PARCEL_ZERO_COPY_OPTIMIZATION:"
"$[hpx.parcel.array_optimization]}",
"enable_security = ${HPX_PARCEL_ENABLE_SECURITY:0}",
"async_serialization = ${HPX_PARCEL_ASYNC_SERIALIZATION:1}"
"async_serialization = ${HPX_PARCEL_ASYNC_SERIALIZATION:1}",
"message_handlers = ${HPX_PARCEL_MESSAGE_HANDLERS:0}"
;

for (plugins::parcelport_factory_base* factory : get_parcelport_factories())
Expand Down

0 comments on commit 77e24f1

Please sign in to comment.