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
a8879903
Commit
a8879903
authored
May 11, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of inspector callback results
parent
58af91e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
libcaf_core/caf/read_inspector.hpp
libcaf_core/caf/read_inspector.hpp
+12
-1
libcaf_core/caf/sec.hpp
libcaf_core/caf/sec.hpp
+8
-2
libcaf_core/caf/write_inspector.hpp
libcaf_core/caf/write_inspector.hpp
+13
-1
No files found.
libcaf_core/caf/read_inspector.hpp
View file @
a8879903
...
...
@@ -78,7 +78,18 @@ private:
template
<
class
R
,
class
T
>
std
::
enable_if_t
<
meta
::
is_annotation_v
<
T
>
,
bool
>
try_apply
(
R
&
result
,
T
&
x
)
{
if
constexpr
(
meta
::
is_save_callback_v
<
T
>
)
{
CAF_READ_INSPECTOR_TRY
(
x
.
fun
())
using
fun_result
=
decltype
(
x
.
fun
());
if
constexpr
(
std
::
is_same
<
fun_result
,
void
>::
value
)
{
x
.
fun
();
}
else
{
if
(
auto
err
=
x
.
fun
())
{
if
constexpr
(
std
::
is_assignable
<
T
&
,
decltype
(
err
)
&&>::
value
)
result
=
std
::
move
(
err
);
else
result
=
sec
::
save_callback_failed
;
return
false
;
}
}
}
return
true
;
}
...
...
libcaf_core/caf/sec.hpp
View file @
a8879903
...
...
@@ -136,15 +136,21 @@ enum class sec : uint8_t {
malformed_basp_message
,
/// The middleman closed a connection because it failed to serialize or
/// deserialize a payload.
serializing_basp_payload_failed
,
serializing_basp_payload_failed
=
50
,
/// The middleman closed a connection to itself or an already connected node.
redundant_connection
,
/// Resolving a path on a remote node failed.
remote_lookup_failed
,
/// Disconnected from a BASP node after reaching the connection timeout.
connection_timeout
,
/// Serialization failed because actor_system::tracing_context is null.
no_tracing_context
,
/// No request produced a valid result.
all_requests_failed
,
/// Serializing failed because a save callback returned an error.
save_callback_failed
,
/// Deserializing failed because a load callback returned an error.
load_callback_failed
,
};
/// @relates sec
...
...
@@ -152,4 +158,4 @@ CAF_CORE_EXPORT std::string to_string(sec);
}
// namespace caf
CAF_ERROR_CODE_ENUM
(
sec
)
CAF_ERROR_CODE_ENUM
(
caf
::
sec
)
libcaf_core/caf/write_inspector.hpp
View file @
a8879903
...
...
@@ -29,6 +29,7 @@
#include "caf/detail/type_traits.hpp"
#include "caf/meta/annotation.hpp"
#include "caf/meta/load_callback.hpp"
#include "caf/sec.hpp"
#include "caf/unifyn.hpp"
#define CAF_WRITE_INSPECTOR_TRY(statement) \
...
...
@@ -81,7 +82,18 @@ private:
template
<
class
R
,
class
T
>
std
::
enable_if_t
<
meta
::
is_annotation_v
<
T
>
,
bool
>
try_apply
(
R
&
result
,
T
&
x
)
{
if
constexpr
(
meta
::
is_load_callback_v
<
T
>
)
{
CAF_WRITE_INSPECTOR_TRY
(
x
.
fun
())
using
fun_result
=
decltype
(
x
.
fun
());
if
constexpr
(
std
::
is_same
<
fun_result
,
void
>::
value
)
{
x
.
fun
();
}
else
{
if
(
auto
err
=
x
.
fun
())
{
if
constexpr
(
std
::
is_assignable
<
T
&
,
decltype
(
err
)
&&>::
value
)
result
=
std
::
move
(
err
);
else
result
=
sec
::
load_callback_failed
;
return
false
;
}
}
}
return
true
;
}
...
...
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