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
a617597a
Commit
a617597a
authored
Jul 24, 2023
by
Samir Halilcevic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send error if a request fails to deserialize
parent
15ab3fd7
Changes
5
Hide 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 @
a617597a
...
@@ -38,6 +38,8 @@ is based on [Keep a Changelog](https://keepachangelog.com).
...
@@ -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
-
We renamed
`caf::flow::item_publisher`
to
`caf::flow::multicaster`
to better
reflect its purpose and to avoid confusion with the new
reflect its purpose and to avoid confusion with the new
`caf::async::publisher`
.
`caf::async::publisher`
.
-
When failing to deserialize a request, the sender will receive an error of
kind
`sec::malformed_message`
.
### Fixed
### Fixed
...
...
libcaf_core/caf/detail/sync_request_bouncer.cpp
View file @
a617597a
...
@@ -22,8 +22,7 @@ sync_request_bouncer::sync_request_bouncer(error r) : rsn(std::move(r)) {
...
@@ -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
,
void
sync_request_bouncer
::
operator
()(
const
strong_actor_ptr
&
sender
,
const
message_id
&
mid
)
const
{
const
message_id
&
mid
)
const
{
if
(
sender
&&
mid
.
is_request
())
if
(
sender
&&
mid
.
is_request
())
sender
->
enqueue
(
nullptr
,
mid
.
response_id
(),
sender
->
enqueue
(
nullptr
,
mid
.
response_id
(),
make_message
(
rsn
),
make_message
(
make_error
(
sec
::
request_receiver_down
)),
// TODO: this breaks out of the execution unit
// TODO: this breaks out of the execution unit
nullptr
);
nullptr
);
}
}
...
...
libcaf_io/caf/io/basp/remote_message_handler.hpp
View file @
a617597a
...
@@ -103,6 +103,8 @@ public:
...
@@ -103,6 +103,8 @@ public:
auto
t0
=
telemetry
::
timer
::
clock_type
::
now
();
auto
t0
=
telemetry
::
timer
::
clock_type
::
now
();
if
(
!
source
.
apply
(
msg
))
{
if
(
!
source
.
apply
(
msg
))
{
CAF_LOG_ERROR
(
"failed to read message content:"
<<
source
.
get_error
());
CAF_LOG_ERROR
(
"failed to read message content:"
<<
source
.
get_error
());
detail
::
sync_request_bouncer
srb
{
sec
::
malformed_message
};
srb
(
src
,
mid
);
return
;
return
;
}
}
telemetry
::
timer
::
observe
(
mm_metrics
.
deserialization_time
,
t0
);
telemetry
::
timer
::
observe
(
mm_metrics
.
deserialization_time
,
t0
);
...
...
libcaf_io/test/io-test.hpp
View file @
a617597a
...
@@ -5,8 +5,16 @@ using calculator
...
@@ -5,8 +5,16 @@ using calculator
=
caf
::
typed_actor
<
caf
::
result
<
int32_t
>
(
caf
::
add_atom
,
int32_t
,
int32_t
),
=
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
)
>
;
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
not
Inspector
::
is_loading
;
}
};
CAF_BEGIN_TYPE_ID_BLOCK
(
io_test
,
caf
::
first_custom_type_id
)
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
,
(
calculator
))
CAF_ADD_TYPE_ID
(
io_test
,
(
non_deserializable_t
))
CAF_END_TYPE_ID_BLOCK
(
io_test
)
CAF_END_TYPE_ID_BLOCK
(
io_test
)
libcaf_io/test/io/middleman.cpp
View file @
a617597a
...
@@ -101,4 +101,20 @@ CAF_TEST(remote_lookup allows registry lookups on other nodes) {
...
@@ -101,4 +101,20 @@ CAF_TEST(remote_lookup allows registry lookups on other nodes) {
anon_send_exit
(
testee
,
exit_reason
::
user_shutdown
);
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
()
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