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
524036ab
Commit
524036ab
authored
Sep 18, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix payload of actor messages
parent
f2486a5d
Changes
2
Hide 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 @
524036ab
...
@@ -190,26 +190,32 @@ error application::handle_handshake(write_packet_callback&, header hdr,
...
@@ -190,26 +190,32 @@ error application::handle_handshake(write_packet_callback&, header hdr,
error
application
::
handle_actor_message
(
write_packet_callback
&
,
header
hdr
,
error
application
::
handle_actor_message
(
write_packet_callback
&
,
header
hdr
,
byte_span
payload
)
{
byte_span
payload
)
{
// Deserialize payload.
// Deserialize payload.
actor_id
src
;
actor_id
src_id
;
actor_id
dst
;
node_id
src_node
;
actor_id
dst_id
;
std
::
vector
<
strong_actor_ptr
>
fwd_stack
;
std
::
vector
<
strong_actor_ptr
>
fwd_stack
;
message
content
;
message
content
;
binary_deserializer
source
{
system
(),
payload
};
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
;
return
err
;
// Sanity checks.
// Sanity checks.
if
(
dst
==
0
)
if
(
dst
_id
==
0
)
return
ec
::
invalid_payload
;
return
ec
::
invalid_payload
;
// Try to fetch the receiver.
// Try to fetch the receiver.
auto
src_hdl
=
system
().
registry
().
get
(
dst
);
auto
dst_hdl
=
system
().
registry
().
get
(
dst_id
);
if
(
src
_hdl
==
nullptr
)
{
if
(
dst
_hdl
==
nullptr
)
{
CAF_LOG_DEBUG
(
"no actor found for given ID, drop message"
);
CAF_LOG_DEBUG
(
"no actor found for given ID, drop message"
);
return
caf
::
none
;
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.
// Ship the message.
src_hdl
->
get
()
->
eq_impl
(
make_message_id
(
hdr
.
operation_data
),
auto
ptr
=
make_mailbox_element
(
std
::
move
(
src_hdl
),
proxies_
->
get_or_put
(
peer_id_
,
src
),
nullptr
,
make_message_id
(
hdr
.
operation_data
),
std
::
move
(
content
));
std
::
move
(
fwd_stack
),
std
::
move
(
content
));
dst_hdl
->
get
()
->
enqueue
(
std
::
move
(
ptr
),
nullptr
);
return
none
;
return
none
;
}
}
...
...
libcaf_net/test/application.cpp
View file @
524036ab
...
@@ -217,7 +217,7 @@ CAF_TEST(actor message) {
...
@@ -217,7 +217,7 @@ CAF_TEST(actor message) {
sys
.
registry
().
put
(
self
->
id
(),
self
);
sys
.
registry
().
put
(
self
->
id
(),
self
);
CAF_REQUIRE_EQUAL
(
self
->
mailbox
().
size
(),
0u
);
CAF_REQUIRE_EQUAL
(
self
->
mailbox
().
size
(),
0u
);
MOCK
(
basp
::
message_type
::
actor_message
,
make_message_id
().
integer_value
(),
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!"
));
make_message
(
"hello world!"
));
allow
((
atom_value
,
strong_actor_ptr
),
allow
((
atom_value
,
strong_actor_ptr
),
from
(
_
).
to
(
self
).
with
(
atom
(
"monitor"
),
_
));
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