Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
892e6ee7
Commit
892e6ee7
authored
Mar 21, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users to disable detaching of MM actors
parent
a5c6c2b7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
5 deletions
+25
-5
examples/caf-application.ini
examples/caf-application.ini
+2
-1
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+1
-0
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+3
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+15
-2
libcaf_io/src/middleman_actor.cpp
libcaf_io/src/middleman_actor.cpp
+4
-1
No files found.
examples/caf-application.ini
View file @
892e6ee7
...
@@ -45,4 +45,5 @@ app-identifier=""
...
@@ -45,4 +45,5 @@ app-identifier=""
max-consecutive-reads
=
50
max-consecutive-reads
=
50
; heartbeat message interval in ms (0 disables heartbeating)
; heartbeat message interval in ms (0 disables heartbeating)
heartbeat-interval
=
0
heartbeat-interval
=
0
; configures whether the MM detaches its internal utility actors
middleman-detach-utility-actors
=
true
libcaf_core/caf/actor_system_config.hpp
View file @
892e6ee7
...
@@ -272,6 +272,7 @@ public:
...
@@ -272,6 +272,7 @@ public:
bool
middleman_enable_automatic_connections
;
bool
middleman_enable_automatic_connections
;
size_t
middleman_max_consecutive_reads
;
size_t
middleman_max_consecutive_reads
;
size_t
middleman_heartbeat_interval
;
size_t
middleman_heartbeat_interval
;
bool
middleman_detach_utility_actors
;
// -- config parameters of the OpenCL module ---------------------------------
// -- config parameters of the OpenCL module ---------------------------------
...
...
libcaf_core/src/actor_system_config.cpp
View file @
892e6ee7
...
@@ -168,7 +168,9 @@ actor_system_config::actor_system_config()
...
@@ -168,7 +168,9 @@ actor_system_config::actor_system_config()
.
add
(
middleman_max_consecutive_reads
,
"max-consecutive-reads"
,
.
add
(
middleman_max_consecutive_reads
,
"max-consecutive-reads"
,
"sets the maximum number of consecutive I/O reads per broker"
)
"sets the maximum number of consecutive I/O reads per broker"
)
.
add
(
middleman_heartbeat_interval
,
"heartbeat-interval"
,
.
add
(
middleman_heartbeat_interval
,
"heartbeat-interval"
,
"sets the interval (ms) of heartbeat, 0 (default) means disabling it"
);
"sets the interval (ms) of heartbeat, 0 (default) means disabling it"
)
.
add
(
middleman_detach_utility_actors
,
"detach-utility-actors"
,
"enables or disables detaching of utility actors"
);
opt_group
(
options_
,
"opencl"
)
opt_group
(
options_
,
"opencl"
)
.
add
(
opencl_device_ids
,
"device-ids"
,
.
add
(
opencl_device_ids
,
"device-ids"
,
"restricts which OpenCL devices are accessed by CAF"
);
"restricts which OpenCL devices are accessed by CAF"
);
...
...
libcaf_io/src/basp_broker.cpp
View file @
892e6ee7
...
@@ -369,6 +369,16 @@ void basp_broker_state::learned_new_node_directly(const node_id& nid,
...
@@ -369,6 +369,16 @@ void basp_broker_state::learned_new_node_directly(const node_id& nid,
learned_new_node
(
nid
);
learned_new_node
(
nid
);
}
}
namespace
{
struct
connection_helper_state
{
static
const
char
*
name
;
};
const
char
*
connection_helper_state
::
name
=
"connection_helper"
;
}
// namespace <anonymous>
void
basp_broker_state
::
learned_new_node_indirectly
(
const
node_id
&
nid
)
{
void
basp_broker_state
::
learned_new_node_indirectly
(
const
node_id
&
nid
)
{
CAF_ASSERT
(
this_context
!=
nullptr
);
CAF_ASSERT
(
this_context
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_ARG
(
nid
));
CAF_LOG_TRACE
(
CAF_ARG
(
nid
));
...
@@ -379,7 +389,8 @@ void basp_broker_state::learned_new_node_indirectly(const node_id& nid) {
...
@@ -379,7 +389,8 @@ void basp_broker_state::learned_new_node_indirectly(const node_id& nid) {
// indirect connection to the routing table; hence, spawning
// indirect connection to the routing table; hence, spawning
// our helper here exactly once and there is no need to track
// our helper here exactly once and there is no need to track
// in-flight connection requests
// in-flight connection requests
auto
connection_helper
=
[
=
](
event_based_actor
*
helper
,
actor
s
)
->
behavior
{
auto
connection_helper
=
[
=
](
stateful_actor
<
connection_helper_state
>*
helper
,
actor
s
)
->
behavior
{
CAF_LOG_TRACE
(
CAF_ARG
(
s
));
CAF_LOG_TRACE
(
CAF_ARG
(
s
));
helper
->
monitor
(
s
);
helper
->
monitor
(
s
);
helper
->
set_down_handler
([
=
](
down_msg
&
dm
)
{
helper
->
set_down_handler
([
=
](
down_msg
&
dm
)
{
...
@@ -432,7 +443,9 @@ void basp_broker_state::learned_new_node_indirectly(const node_id& nid) {
...
@@ -432,7 +443,9 @@ void basp_broker_state::learned_new_node_indirectly(const node_id& nid) {
return
;
return
;
}
}
using
namespace
detail
;
using
namespace
detail
;
auto
tmp
=
system
().
spawn
<
detached
+
hidden
>
(
connection_helper
,
self
);
auto
tmp
=
system
().
config
().
middleman_detach_utility_actors
?
system
().
spawn
<
detached
+
hidden
>
(
connection_helper
,
self
)
:
system
().
spawn
<
hidden
>
(
connection_helper
,
self
);
system
().
registry
().
put
(
tmp
.
id
(),
actor_cast
<
strong_actor_ptr
>
(
tmp
));
system
().
registry
().
put
(
tmp
.
id
(),
actor_cast
<
strong_actor_ptr
>
(
tmp
));
auto
writer
=
make_callback
([](
serializer
&
sink
)
->
error
{
auto
writer
=
make_callback
([](
serializer
&
sink
)
->
error
{
auto
name_atm
=
atom
(
"ConfigServ"
);
auto
name_atm
=
atom
(
"ConfigServ"
);
...
...
libcaf_io/src/middleman_actor.cpp
View file @
892e6ee7
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "caf/logger.hpp"
#include "caf/logger.hpp"
#include "caf/node_id.hpp"
#include "caf/node_id.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/typed_event_based_actor.hpp"
#include "caf/typed_event_based_actor.hpp"
#include "caf/io/basp_broker.hpp"
#include "caf/io/basp_broker.hpp"
...
@@ -223,7 +224,9 @@ private:
...
@@ -223,7 +224,9 @@ private:
}
// namespace <anonymous>
}
// namespace <anonymous>
middleman_actor
make_middleman_actor
(
actor_system
&
sys
,
actor
db
)
{
middleman_actor
make_middleman_actor
(
actor_system
&
sys
,
actor
db
)
{
return
sys
.
spawn
<
middleman_actor_impl
,
detached
+
hidden
>
(
std
::
move
(
db
));
return
sys
.
config
().
middleman_detach_utility_actors
?
sys
.
spawn
<
middleman_actor_impl
,
detached
+
hidden
>
(
std
::
move
(
db
))
:
sys
.
spawn
<
middleman_actor_impl
,
hidden
>
(
std
::
move
(
db
));
}
}
}
// namespace io
}
// namespace io
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment