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
e352277b
Commit
e352277b
authored
Nov 15, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak in group_tunnel
parent
bb1a8c30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
libcaf_core/src/detail/group_tunnel.cpp
libcaf_core/src/detail/group_tunnel.cpp
+6
-4
libcaf_core/test/detail/group_tunnel.cpp
libcaf_core/test/detail/group_tunnel.cpp
+5
-2
No files found.
libcaf_core/src/detail/group_tunnel.cpp
View file @
e352277b
...
...
@@ -120,15 +120,17 @@ void group_tunnel::stop() {
CAF_LOG_TRACE
(
""
);
CAF_LOG_DEBUG
(
"stop group tunnel:"
<<
CAF_ARG2
(
"module"
,
module
().
name
())
<<
CAF_ARG2
(
"identifier"
,
identifier_
));
auto
hdl
=
actor
{};
auto
worker_hdl
=
actor
{};
auto
intermediary_hdl
=
actor
{};
auto
subs
=
subscriber_set
{};
auto
cache
=
cached_message_list
{};
auto
stopped
=
critical_section
([
this
,
&
hdl
,
&
subs
,
&
cache
]
{
auto
stopped
=
critical_section
([
&
,
this
]
{
using
std
::
swap
;
if
(
!
stopped_
)
{
stopped_
=
true
;
swap
(
subs
,
subscribers_
);
swap
(
hdl
,
worker_
);
swap
(
worker_hdl
,
worker_
);
swap
(
intermediary_hdl
,
intermediary_
);
swap
(
cache
,
cached_messages_
);
return
true
;
}
else
{
...
...
@@ -136,7 +138,7 @@ void group_tunnel::stop() {
}
});
if
(
stopped
)
{
anon_send_exit
(
hdl
,
exit_reason
::
user_shutdown
);
anon_send_exit
(
worker_
hdl
,
exit_reason
::
user_shutdown
);
if
(
!
subs
.
empty
())
{
auto
bye
=
make_message
(
group_down_msg
{
group
{
this
}});
for
(
auto
&
sub
:
subs
)
...
...
libcaf_core/test/detail/group_tunnel.cpp
View file @
e352277b
...
...
@@ -83,8 +83,9 @@ struct testee_state {
behavior
testee_impl
(
stateful_actor
<
testee_state
>*
self
)
{
return
{
[
=
](
put_atom
,
int
x
)
{
self
->
state
.
x
=
x
;
},
[
=
](
get_atom
)
{
return
self
->
state
.
x
;
},
[
self
](
put_atom
,
int
x
)
{
self
->
state
.
x
=
x
;
},
[
self
](
get_atom
)
{
return
self
->
state
.
x
;
},
[
self
](
const
group_down_msg
&
)
{
self
->
quit
();
},
};
}
...
...
@@ -103,9 +104,11 @@ struct fixture : test_coordinator_fixture<> {
// Groups keep their subscribers alive (on purpose). Since we don't want to
// manually kill all our testee actors, we simply force the group modules to
// stop here.
uut
->
stop
();
for
(
auto
&
kvp
:
uut
->
instances
)
kvp
.
second
->
stop
();
sys
.
groups
().
get_module
(
"local"
)
->
stop
();
run
();
}
void
make_unconnected
()
{
...
...
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