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
d32b78d0
Commit
d32b78d0
authored
Apr 21, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leaks in group and I/O modules, relates #454
parent
827149d9
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
26 additions
and
37 deletions
+26
-37
libcaf_core/caf/node_id.hpp
libcaf_core/caf/node_id.hpp
+1
-1
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+2
-0
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+1
-0
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+4
-2
libcaf_io/caf/io/network/asio_multiplexer_impl.hpp
libcaf_io/caf/io/network/asio_multiplexer_impl.hpp
+1
-0
libcaf_io/caf/io/network/manager.hpp
libcaf_io/caf/io/network/manager.hpp
+2
-4
libcaf_io/src/abstract_broker.cpp
libcaf_io/src/abstract_broker.cpp
+2
-24
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+3
-2
libcaf_io/src/manager.cpp
libcaf_io/src/manager.cpp
+6
-2
libcaf_io/src/middleman.cpp
libcaf_io/src/middleman.cpp
+0
-1
libcaf_io/src/test_multiplexer.cpp
libcaf_io/src/test_multiplexer.cpp
+4
-1
No files found.
libcaf_core/caf/node_id.hpp
View file @
d32b78d0
...
...
@@ -115,7 +115,7 @@ public:
// nop
}
static
data
*
create_singleton
();
static
intrusive_ptr
<
data
>
create_singleton
();
int
compare
(
const
node_id
&
other
)
const
;
...
...
libcaf_core/src/actor_system.cpp
View file @
d32b78d0
...
...
@@ -131,6 +131,7 @@ actor_system::actor_system(actor_system_config&& cfg)
for
(
auto
&
mod
:
modules_
)
if
(
mod
)
mod
->
start
();
groups_
.
start
();
// store config parameters in ConfigServ
auto
cs
=
actor_cast
<
actor
>
(
registry_
.
get
(
atom
(
"ConfigServ"
)));
anon_send
(
cs
,
put_atom
::
value
,
"middleman.enable-automatic-connections"
,
...
...
@@ -140,6 +141,7 @@ actor_system::actor_system(actor_system_config&& cfg)
actor_system
::~
actor_system
()
{
if
(
await_actors_before_shutdown_
)
await_all_actors_done
();
groups_
.
stop
();
// stop modules in reverse order
for
(
auto
i
=
modules_
.
rbegin
();
i
!=
modules_
.
rend
();
++
i
)
if
(
*
i
)
...
...
libcaf_core/src/local_actor.cpp
View file @
d32b78d0
...
...
@@ -99,6 +99,7 @@ local_actor::local_actor(int init_flags)
}
local_actor
::~
local_actor
()
{
CAF_LOG_TRACE
(
CAF_ARG
(
planned_exit_reason
()));
if
(
planned_exit_reason
()
==
exit_reason
::
not_exited
)
cleanup
(
exit_reason
::
unreachable
,
nullptr
);
}
...
...
libcaf_core/src/node_id.cpp
View file @
d32b78d0
...
...
@@ -141,7 +141,7 @@ std::atomic<uint8_t> system_id;
}
// <anonymous>
// initializes singleton
node_id
::
data
*
node_id
::
data
::
create_singleton
()
{
intrusive_ptr
<
node_id
::
data
>
node_id
::
data
::
create_singleton
()
{
CAF_LOG_TRACE
(
""
);
auto
ifs
=
detail
::
get_mac_addresses
();
std
::
vector
<
std
::
string
>
macs
;
...
...
@@ -157,7 +157,9 @@ node_id::data* node_id::data::create_singleton() {
// by overriding the last byte in the node ID with the actor system "ID"
nid
.
back
()
=
system_id
.
fetch_add
(
1
);
// note: pointer has a ref count of 1 -> implicitly held by detail::singletons
return
new
node_id
::
data
(
detail
::
get_process_id
(),
nid
);
intrusive_ptr
<
data
>
result
;
result
.
reset
(
new
node_id
::
data
(
detail
::
get_process_id
(),
nid
),
false
);
return
result
;
}
uint32_t
node_id
::
process_id
()
const
{
...
...
libcaf_io/caf/io/network/asio_multiplexer_impl.hpp
View file @
d32b78d0
...
...
@@ -300,6 +300,7 @@ void asio_multiplexer::exec_later(resumable* rptr) {
exec_later
(
ptr
.
get
());
break
;
case
resumable
:
:
done
:
case
resumable
:
:
awaiting_message
:
intrusive_ptr_release
(
ptr
.
get
());
break
;
default:
...
...
libcaf_io/caf/io/network/manager.hpp
View file @
d32b78d0
...
...
@@ -44,9 +44,7 @@ public:
void
set_parent
(
abstract_broker
*
ptr
);
/// Returns the parent broker of this manager.
inline
abstract_broker
*
parent
()
{
return
parent_
;
}
abstract_broker
*
parent
();
/// Returns `true` if this manager has a parent, `false` otherwise.
inline
bool
detached
()
const
{
...
...
@@ -78,7 +76,7 @@ protected:
virtual
void
detach_from
(
abstract_broker
*
ptr
)
=
0
;
private:
abstract_broker
*
parent_
;
strong_actor_ptr
parent_
;
};
}
// namespace network
...
...
libcaf_io/src/abstract_broker.cpp
View file @
d32b78d0
...
...
@@ -42,41 +42,19 @@ void abstract_broker::enqueue(strong_actor_ptr src, message_id mid,
void
abstract_broker
::
enqueue
(
mailbox_element_ptr
ptr
,
execution_unit
*
)
{
CAF_PUSH_AID
(
id
());
CAF_LOG_TRACE
(
"enqueue "
<<
CAF_ARG
(
ptr
->
msg
));
auto
mid
=
ptr
->
mid
;
auto
sender
=
ptr
->
sender
;
switch
(
mailbox
().
enqueue
(
ptr
.
release
()))
{
case
detail
:
:
enqueue_result
::
unblocked_reader
:
{
// re-schedule broker
CAF_LOG_DEBUG
(
"unblocked_reader"
);
backend
().
exec_later
(
this
);
break
;
}
case
detail
:
:
enqueue_result
::
queue_closed
:
{
CAF_LOG_DEBUG
(
"queue_closed"
);
if
(
mid
.
is_request
())
{
detail
::
sync_request_bouncer
f
{
exit_reason
()};
f
(
sender
,
mid
);
}
break
;
}
case
detail
:
:
enqueue_result
::
success
:
// enqueued to a running actors' mailbox; nothing to do
CAF_LOG_DEBUG
(
"success"
);
break
;
}
local_actor
::
enqueue
(
std
::
move
(
ptr
),
&
backend
());
}
void
abstract_broker
::
launch
(
execution_unit
*
eu
,
bool
is_lazy
,
bool
is_hidden
)
{
CAF_ASSERT
(
eu
!=
nullptr
);
CAF_ASSERT
(
eu
==
&
backend
());
// add implicit reference count held by middleman/multiplexer
intrusive_ptr_add_ref
(
ctrl
());
is_registered
(
!
is_hidden
);
CAF_PUSH_AID
(
id
());
CAF_LOG_TRACE
(
"init and launch broker:"
<<
CAF_ARG
(
id
()));
if
(
is_lazy
&&
mailbox
().
try_block
())
return
;
intrusive_ptr_add_ref
(
ctrl
());
eu
->
exec_later
(
this
);
}
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
d32b78d0
...
...
@@ -984,10 +984,11 @@ void pipe_reader::handle_event(operation op) {
backend
().
exec_later
(
cb
);
break
;
case
resumable
:
:
done
:
case
resumable
:
:
awaiting_message
:
intrusive_ptr_release
(
cb
);
break
;
default:
;
// ignored
break
;
// ignored
}
break
;
}
...
...
libcaf_io/src/manager.cpp
View file @
d32b78d0
...
...
@@ -27,7 +27,7 @@ namespace caf {
namespace
io
{
namespace
network
{
manager
::
manager
(
abstract_broker
*
ptr
)
:
parent_
(
ptr
)
{
manager
::
manager
(
abstract_broker
*
ptr
)
:
parent_
(
ptr
->
ctrl
()
)
{
// nop
}
...
...
@@ -37,7 +37,11 @@ manager::~manager() {
void
manager
::
set_parent
(
abstract_broker
*
ptr
)
{
if
(
!
detached
())
parent_
=
ptr
;
parent_
=
ptr
?
ptr
->
ctrl
()
:
nullptr
;
}
abstract_broker
*
manager
::
parent
()
{
return
parent_
?
static_cast
<
abstract_broker
*>
(
parent_
->
get
())
:
nullptr
;
}
void
manager
::
detach
(
execution_unit
*
ctx
,
bool
invoke_disconnect_message
)
{
...
...
libcaf_io/src/middleman.cpp
View file @
d32b78d0
...
...
@@ -301,7 +301,6 @@ void middleman::stop() {
ptr
->
context
(
&
backend
());
ptr
->
planned_exit_reason
(
exit_reason
::
normal
);
ptr
->
finished
();
//intrusive_ptr_release(ptr);
}
}
});
...
...
libcaf_io/src/test_multiplexer.cpp
View file @
d32b78d0
...
...
@@ -33,7 +33,9 @@ test_multiplexer::test_multiplexer(actor_system* sys) : multiplexer(sys) {
}
test_multiplexer
::~
test_multiplexer
()
{
// nop
// get rid of extra ref count
for
(
auto
&
ptr
:
resumables_
)
intrusive_ptr_release
(
ptr
.
get
());
}
connection_handle
...
...
@@ -393,6 +395,7 @@ void test_multiplexer::exec(resumable_ptr& ptr) {
exec_later
(
ptr
.
get
());
break
;
case
resumable
:
:
done
:
case
resumable
:
:
awaiting_message
:
intrusive_ptr_release
(
ptr
.
get
());
break
;
default:
...
...
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