Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
290fc0c5
Commit
290fc0c5
authored
Sep 18, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix payload of actor messages
parent
9c26fb25
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
libcaf_net/src/application.cpp
libcaf_net/src/application.cpp
+15
-9
libcaf_net/test/application.cpp
libcaf_net/test/application.cpp
+1
-1
No files found.
libcaf_net/src/application.cpp
View file @
290fc0c5
...
...
@@ -190,26 +190,32 @@ error application::handle_handshake(write_packet_callback&, header hdr,
error
application
::
handle_actor_message
(
write_packet_callback
&
,
header
hdr
,
byte_span
payload
)
{
// Deserialize payload.
actor_id
src
;
actor_id
dst
;
actor_id
src_id
;
node_id
src_node
;
actor_id
dst_id
;
std
::
vector
<
strong_actor_ptr
>
fwd_stack
;
message
content
;
binary_deserializer
source
{
system
(),
payload
};
if
(
auto
err
=
source
(
src
,
dst
,
fwd_stack
,
content
))
if
(
auto
err
=
source
(
src
_node
,
src_id
,
dst_id
,
fwd_stack
,
content
))
return
err
;
// Sanity checks.
if
(
dst
==
0
)
if
(
dst
_id
==
0
)
return
ec
::
invalid_payload
;
// Try to fetch the receiver.
auto
src_hdl
=
system
().
registry
().
get
(
dst
);
if
(
src
_hdl
==
nullptr
)
{
auto
dst_hdl
=
system
().
registry
().
get
(
dst_id
);
if
(
dst
_hdl
==
nullptr
)
{
CAF_LOG_DEBUG
(
"no actor found for given ID, drop message"
);
return
caf
::
none
;
}
// Try to fetch the sender.
strong_actor_ptr
src_hdl
;
if
(
src_node
!=
none
&&
src_id
!=
0
)
src_hdl
=
proxies_
->
get_or_put
(
src_node
,
src_id
);
// Ship the message.
src_hdl
->
get
()
->
eq_impl
(
make_message_id
(
hdr
.
operation_data
),
proxies_
->
get_or_put
(
peer_id_
,
src
),
nullptr
,
std
::
move
(
content
));
auto
ptr
=
make_mailbox_element
(
std
::
move
(
src_hdl
),
make_message_id
(
hdr
.
operation_data
),
std
::
move
(
fwd_stack
),
std
::
move
(
content
));
dst_hdl
->
get
()
->
enqueue
(
std
::
move
(
ptr
),
nullptr
);
return
none
;
}
...
...
libcaf_net/test/application.cpp
View file @
290fc0c5
...
...
@@ -217,7 +217,7 @@ CAF_TEST(actor message) {
sys
.
registry
().
put
(
self
->
id
(),
self
);
CAF_REQUIRE_EQUAL
(
self
->
mailbox
().
size
(),
0u
);
MOCK
(
basp
::
message_type
::
actor_message
,
make_message_id
().
integer_value
(),
actor_id
{
42
},
self
->
id
(),
std
::
vector
<
strong_actor_ptr
>
{},
mars
,
actor_id
{
42
},
self
->
id
(),
std
::
vector
<
strong_actor_ptr
>
{},
make_message
(
"hello world!"
));
allow
((
atom_value
,
strong_actor_ptr
),
from
(
_
).
to
(
self
).
with
(
atom
(
"monitor"
),
_
));
...
...
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