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
44de1c92
Commit
44de1c92
authored
Feb 17, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix false warning when using response promises
parent
0c4ebcfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
40 deletions
+42
-40
libcaf_core/caf/policy/invoke_policy.hpp
libcaf_core/caf/policy/invoke_policy.hpp
+42
-40
No files found.
libcaf_core/caf/policy/invoke_policy.hpp
View file @
44de1c92
...
@@ -174,7 +174,10 @@ class invoke_policy {
...
@@ -174,7 +174,10 @@ class invoke_policy {
if
(
res
->
empty
())
{
if
(
res
->
empty
())
{
// make sure synchronous requests always receive a response;
// make sure synchronous requests always receive a response;
// note: !current_element() means client has forwarded the request
// note: !current_element() means client has forwarded the request
if
(
self
->
current_element
()
&&
mid
.
is_request
()
&&
!
mid
.
is_answered
())
{
auto
&
ptr
=
self
->
current_element
();
if
(
ptr
)
{
mid
=
ptr
->
mid
;
if
(
mid
.
is_request
()
&&
!
mid
.
is_answered
())
{
CAF_LOG_WARNING
(
"actor with ID "
<<
self
->
id
()
CAF_LOG_WARNING
(
"actor with ID "
<<
self
->
id
()
<<
" did not reply to a synchronous request message"
);
<<
" did not reply to a synchronous request message"
);
auto
fhdl
=
fetch_response_promise
(
self
,
hdl
);
auto
fhdl
=
fetch_response_promise
(
self
,
hdl
);
...
@@ -182,11 +185,11 @@ class invoke_policy {
...
@@ -182,11 +185,11 @@ class invoke_policy {
fhdl
.
deliver
(
make_message
(
unit
));
fhdl
.
deliver
(
make_message
(
unit
));
}
}
}
}
}
else
{
}
return
res
;
}
CAF_LOGF_DEBUG
(
"res = "
<<
to_string
(
*
res
));
CAF_LOGF_DEBUG
(
"res = "
<<
to_string
(
*
res
));
if
(
res
->
size
()
==
2
if
(
res
->
template
match_elements
<
atom_value
,
uint64_t
>()
&&
res
->
match_element
(
0
,
detail
::
type_nr
<
atom_value
>::
value
,
nullptr
)
&&
res
->
match_element
(
1
,
detail
::
type_nr
<
uint64_t
>::
value
,
nullptr
)
&&
res
->
template
get_as
<
atom_value
>(
0
)
==
atom
(
"MESSAGE_ID"
))
{
&&
res
->
template
get_as
<
atom_value
>(
0
)
==
atom
(
"MESSAGE_ID"
))
{
CAF_LOG_DEBUG
(
"message handler returned a message id wrapper"
);
CAF_LOG_DEBUG
(
"message handler returned a message id wrapper"
);
auto
id
=
res
->
template
get_as
<
uint64_t
>(
1
);
auto
id
=
res
->
template
get_as
<
uint64_t
>(
1
);
...
@@ -208,17 +211,16 @@ class invoke_policy {
...
@@ -208,17 +211,16 @@ class invoke_policy {
}
}
);
);
}
}
}
else
{
return
res
;
}
// respond by using the result of 'fun'
// respond by using the result of 'fun'
CAF_LOG_DEBUG
(
"respond via response_promise"
);
CAF_LOG_DEBUG
(
"respond via response_promise"
);
auto
fhdl
=
fetch_response_promise
(
self
,
hdl
);
auto
fhdl
=
fetch_response_promise
(
self
,
hdl
);
if
(
fhdl
)
{
if
(
fhdl
)
{
fhdl
.
deliver
(
std
::
move
(
*
res
));
fhdl
.
deliver
(
std
::
move
(
*
res
));
// inform caller about success
// inform caller about success by returning not none
return
message
{};
return
message
{};
}
}
}
}
return
res
;
return
res
;
}
}
...
...
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