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
bb22e7fe
Unverified
Commit
bb22e7fe
authored
Jul 25, 2023
by
Samir Halilčević
Committed by
GitHub
Jul 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send error if a request fails to deserialize
parent
bd9c5704
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
2 deletions
+29
-2
CHANGELOG.md
CHANGELOG.md
+2
-0
libcaf_core/caf/detail/sync_request_bouncer.cpp
libcaf_core/caf/detail/sync_request_bouncer.cpp
+1
-2
libcaf_io/caf/io/basp/remote_message_handler.hpp
libcaf_io/caf/io/basp/remote_message_handler.hpp
+2
-0
libcaf_io/test/io-test.hpp
libcaf_io/test/io-test.hpp
+8
-0
libcaf_io/test/io/middleman.cpp
libcaf_io/test/io/middleman.cpp
+16
-0
No files found.
CHANGELOG.md
View file @
bb22e7fe
...
...
@@ -38,6 +38,8 @@ is based on [Keep a Changelog](https://keepachangelog.com).
-
We renamed
`caf::flow::item_publisher`
to
`caf::flow::multicaster`
to better
reflect its purpose and to avoid confusion with the new
`caf::async::publisher`
.
-
When failing to deserialize a request, the sender will receive an error of
kind
`sec::malformed_message`
.
### Fixed
...
...
libcaf_core/caf/detail/sync_request_bouncer.cpp
View file @
bb22e7fe
...
...
@@ -22,8 +22,7 @@ sync_request_bouncer::sync_request_bouncer(error r) : rsn(std::move(r)) {
void
sync_request_bouncer
::
operator
()(
const
strong_actor_ptr
&
sender
,
const
message_id
&
mid
)
const
{
if
(
sender
&&
mid
.
is_request
())
sender
->
enqueue
(
nullptr
,
mid
.
response_id
(),
make_message
(
make_error
(
sec
::
request_receiver_down
)),
sender
->
enqueue
(
nullptr
,
mid
.
response_id
(),
make_message
(
rsn
),
// TODO: this breaks out of the execution unit
nullptr
);
}
...
...
libcaf_io/caf/io/basp/remote_message_handler.hpp
View file @
bb22e7fe
...
...
@@ -103,6 +103,8 @@ public:
auto
t0
=
telemetry
::
timer
::
clock_type
::
now
();
if
(
!
source
.
apply
(
msg
))
{
CAF_LOG_ERROR
(
"failed to read message content:"
<<
source
.
get_error
());
src
->
enqueue
(
nullptr
,
mid
.
response_id
(),
make_message
(
make_error
(
sec
::
malformed_message
)),
nullptr
);
return
;
}
telemetry
::
timer
::
observe
(
mm_metrics
.
deserialization_time
,
t0
);
...
...
libcaf_io/test/io-test.hpp
View file @
bb22e7fe
...
...
@@ -5,8 +5,16 @@ using calculator
=
caf
::
typed_actor
<
caf
::
result
<
int32_t
>
(
caf
::
add_atom
,
int32_t
,
int32_t
),
caf
::
result
<
int32_t
>
(
caf
::
sub_atom
,
int32_t
,
int32_t
)
>
;
struct
non_deserializable_t
{
template
<
typename
Inspector
>
friend
bool
inspect
(
Inspector
&
,
non_deserializable_t
&
)
{
return
!
Inspector
::
is_loading
;
}
};
CAF_BEGIN_TYPE_ID_BLOCK
(
io_test
,
caf
::
first_custom_type_id
)
CAF_ADD_TYPE_ID
(
io_test
,
(
calculator
))
CAF_ADD_TYPE_ID
(
io_test
,
(
non_deserializable_t
))
CAF_END_TYPE_ID_BLOCK
(
io_test
)
libcaf_io/test/io/middleman.cpp
View file @
bb22e7fe
...
...
@@ -101,4 +101,20 @@ CAF_TEST(remote_lookup allows registry lookups on other nodes) {
anon_send_exit
(
testee
,
exit_reason
::
user_shutdown
);
}
CAF_TEST
(
failing
to
deserialize
a
request
reports
an
error
to
the
sender
)
{
auto
testee_impl
=
[]()
->
behavior
{
return
{
[](
non_deserializable_t
)
{
return
0
;
},
};
};
auto
testee
=
earth
.
sys
.
spawn
(
testee_impl
);
earth
.
sys
.
registry
().
put
(
"testee"
,
testee
);
auto
testee_proxy_ptr
=
mars
.
mm
.
remote_lookup
(
"testee"
,
earth
.
sys
.
node
());
auto
testee_proxy
=
actor_cast
<
actor
>
(
testee_proxy_ptr
);
mars
.
self
->
request
(
testee_proxy
,
caf
::
infinite
,
non_deserializable_t
{})
.
receive
([](
int32_t
)
{
CAF_FAIL
(
"Expected an error"
);
},
[](
caf
::
error
&
err
)
{
CHECK_EQ
(
err
,
sec
::
malformed_message
);
});
anon_send_exit
(
testee
,
exit_reason
::
user_shutdown
);
}
END_FIXTURE_SCOPE
()
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