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
2fd7996b
Commit
2fd7996b
authored
May 09, 2018
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ambiguities
parent
2e655705
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+21
-20
No files found.
libcaf_core/src/actor_system.cpp
View file @
2fd7996b
...
...
@@ -215,7 +215,7 @@ behavior peer_serv_impl(stateful_actor<peer_state>* self) {
unsubscribe_all
(
actor_cast
<
actor
>
(
std
::
move
(
ptr
)));
});
return
{
//
set a key/value pair
//
Set a key/value pair.
[
=
](
put_atom
,
const
std
::
string
&
key
,
message
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
key
)
<<
CAF_ARG
(
msg
));
if
(
key
==
wildcard
||
key
.
empty
())
...
...
@@ -223,7 +223,7 @@ behavior peer_serv_impl(stateful_actor<peer_state>* self) {
auto
&
vp
=
self
->
state
.
data
[
key
];
vp
.
first
=
std
::
move
(
msg
);
for
(
auto
&
subscriber_ptr
:
vp
.
second
)
{
//
we never put a nullptr in our map
//
We never put a nullptr in our map.
auto
subscriber
=
actor_cast
<
actor
>
(
subscriber_ptr
);
if
(
subscriber
!=
self
->
current_sender
())
{
self
->
send
(
subscriber
,
key
,
vp
.
first
);
...
...
@@ -232,29 +232,30 @@ behavior peer_serv_impl(stateful_actor<peer_state>* self) {
}
self
->
state
.
data
[
key
].
second
.
clear
();
},
//
get a key/value pair
//
Get a key/value pair.
[
=
](
get_atom
,
std
::
string
&
key
)
{
auto
subscriber
=
actor_cast
<
strong_actor_ptr
>
(
self
->
current_sender
());
CAF_LOG_TRACE
(
CAF_ARG
(
key
));
// Get the value ...
if
(
key
==
wildcard
||
key
.
empty
())
return
;
auto
d
=
self
->
state
.
data
.
find
(
key
);
if
(
d
!=
self
->
state
.
data
.
end
())
{
self
->
send
(
subscriber
,
std
::
move
(
key
),
d
->
second
.
first
);
return
;
}
// ... or sub if it is not available.
CAF_LOG_TRACE
(
CAF_ARG
(
key
)
<<
CAF_ARG
(
subscriber
));
if
(
subscriber
)
{
self
->
state
.
data
[
key
].
second
.
insert
(
subscriber
);
auto
sender
=
actor_cast
<
strong_actor_ptr
>
(
self
->
current_sender
());
if
(
sender
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
key
));
// Get the value ...
if
(
key
==
wildcard
||
key
.
empty
())
return
;
auto
d
=
self
->
state
.
data
.
find
(
key
);
if
(
d
!=
self
->
state
.
data
.
end
())
{
self
->
send
(
actor_cast
<
actor
>
(
sender
),
std
::
move
(
key
),
d
->
second
.
first
);
return
;
}
// ... or sub if it is not available.
CAF_LOG_TRACE
(
CAF_ARG
(
key
)
<<
CAF_ARG
(
sender
));
self
->
state
.
data
[
key
].
second
.
insert
(
sender
);
auto
&
subscribers
=
self
->
state
.
subscribers
;
auto
s
=
subscribers
.
find
(
s
ubscrib
er
);
auto
s
=
subscribers
.
find
(
s
end
er
);
if
(
s
!=
subscribers
.
end
())
{
s
->
second
.
insert
(
key
);
}
else
{
self
->
monitor
(
s
ubscrib
er
);
subscribers
.
emplace
(
s
ubscrib
er
,
peer_state
::
topic_set
{
key
});
self
->
monitor
(
s
end
er
);
subscribers
.
emplace
(
s
end
er
,
peer_state
::
topic_set
{
key
});
}
}
}
...
...
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