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
eb3ecd99
Commit
eb3ecd99
authored
Oct 16, 2014
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug with actors not leaving their groups
This bug was reported on the mailing list
parent
0a1342aa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
libcaf_core/caf/abstract_actor.hpp
libcaf_core/caf/abstract_actor.hpp
+2
-2
libcaf_core/caf/abstract_group.hpp
libcaf_core/caf/abstract_group.hpp
+2
-0
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+5
-2
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+4
-1
No files found.
libcaf_core/caf/abstract_actor.hpp
View file @
eb3ecd99
...
...
@@ -110,10 +110,10 @@ class abstract_actor : public abstract_channel {
/**
* Detaches the first attached object that matches `what`.
*/
void
detach
(
const
attachable
::
token
&
what
);
size_t
detach
(
const
attachable
::
token
&
what
);
template
<
class
T
>
void
detach
(
const
T
&
what
)
{
size_t
detach
(
const
T
&
what
)
{
return
detach
(
attachable
::
token
{
typeid
(
T
),
&
what
});
}
...
...
libcaf_core/caf/abstract_group.hpp
View file @
eb3ecd99
...
...
@@ -41,6 +41,7 @@ namespace caf {
class
group
;
class
serializer
;
class
local_actor
;
class
deserializer
;
/**
...
...
@@ -50,6 +51,7 @@ class abstract_group : public abstract_channel {
public:
friend
class
detail
::
group_manager
;
friend
class
detail
::
peer_connection
;
friend
class
local_actor
;
~
abstract_group
();
...
...
libcaf_core/src/abstract_actor.cpp
View file @
eb3ecd99
...
...
@@ -87,11 +87,14 @@ size_t abstract_actor::detach_impl(const attachable::token& what,
attachable_ptr
&
ptr
,
bool
stop_on_hit
,
bool
dry_run
)
{
CAF_LOGF_TRACE
(
""
);
if
(
!
ptr
)
{
CAF_LOGF_DEBUG
(
"invalid ptr"
);
return
0
;
}
if
(
ptr
->
matches
(
what
))
{
if
(
!
dry_run
)
{
CAF_LOGF_DEBUG
(
"removed element"
);
attachable_ptr
next
;
next
.
swap
(
ptr
->
next
);
ptr
.
swap
(
next
);
...
...
@@ -101,10 +104,10 @@ size_t abstract_actor::detach_impl(const attachable::token& what,
return
detach_impl
(
what
,
ptr
->
next
,
stop_on_hit
,
dry_run
);
}
void
abstract_actor
::
detach
(
const
attachable
::
token
&
what
)
{
size_t
abstract_actor
::
detach
(
const
attachable
::
token
&
what
)
{
CAF_LOG_TRACE
(
""
);
guard_type
guard
{
m_mtx
};
detach_impl
(
what
,
m_attachables_head
);
return
detach_impl
(
what
,
m_attachables_head
);
}
bool
abstract_actor
::
link_impl
(
linking_operation
op
,
const
actor_addr
&
other
)
{
...
...
libcaf_core/src/local_actor.cpp
View file @
eb3ecd99
...
...
@@ -76,10 +76,13 @@ void local_actor::join(const group& what) {
}
void
local_actor
::
leave
(
const
group
&
what
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
what
));
if
(
what
==
invalid_group
)
{
return
;
}
detach
(
abstract_group
::
subscription_token
{
what
.
ptr
()});
if
(
detach
(
abstract_group
::
subscription_token
{
what
.
ptr
()})
>
0
)
{
what
->
unsubscribe
(
address
());
}
}
std
::
vector
<
group
>
local_actor
::
joined_groups
()
const
{
...
...
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