Commit 0d1de2d6 authored by Dominik Charousset's avatar Dominik Charousset

Add logging output to fan_in policy

parent 15715406
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "caf/detail/type_traits.hpp" #include "caf/detail/type_traits.hpp"
#include "caf/detail/typed_actor_util.hpp" #include "caf/detail/typed_actor_util.hpp"
#include "caf/error.hpp" #include "caf/error.hpp"
#include "caf/logger.hpp"
#include "caf/message_id.hpp" #include "caf/message_id.hpp"
namespace caf { namespace caf {
...@@ -42,6 +43,7 @@ struct fan_in_responses_helper { ...@@ -42,6 +43,7 @@ struct fan_in_responses_helper {
F f; F f;
void operator()(T& x) { void operator()(T& x) {
CAF_LOG_TRACE(CAF_ARG2("pending", *pending));
if (*pending > 0) { if (*pending > 0) {
results.emplace_back(std::move(x)); results.emplace_back(std::move(x));
if (--*pending == 0) if (--*pending == 0)
...@@ -69,6 +71,7 @@ struct fan_in_responses_tuple_helper { ...@@ -69,6 +71,7 @@ struct fan_in_responses_tuple_helper {
F f; F f;
void operator()(Ts&... xs) { void operator()(Ts&... xs) {
CAF_LOG_TRACE(CAF_ARG2("pending", *pending));
if (*pending > 0) { if (*pending > 0) {
results.emplace_back(std::move(xs)...); results.emplace_back(std::move(xs)...);
if (--*pending == 0) if (--*pending == 0)
...@@ -117,6 +120,7 @@ public: ...@@ -117,6 +120,7 @@ public:
} }
void operator()(error& err) { void operator()(error& err) {
CAF_LOG_TRACE(CAF_ARG2("pending", *pending));
if (*pending > 0) { if (*pending > 0) {
*pending = 0; *pending = 0;
handler(err); handler(err);
...@@ -162,6 +166,7 @@ public: ...@@ -162,6 +166,7 @@ public:
template <class Self, class F, class OnError> template <class Self, class F, class OnError>
void await(Self* self, F&& f, OnError&& g) const { void await(Self* self, F&& f, OnError&& g) const {
CAF_LOG_TRACE(CAF_ARG(ids_));
auto bhvr = make_behavior(std::forward<F>(f), std::forward<OnError>(g)); auto bhvr = make_behavior(std::forward<F>(f), std::forward<OnError>(g));
for (auto id : ids_) for (auto id : ids_)
self->add_awaited_response_handler(id, bhvr); self->add_awaited_response_handler(id, bhvr);
...@@ -169,6 +174,7 @@ public: ...@@ -169,6 +174,7 @@ public:
template <class Self, class F, class OnError> template <class Self, class F, class OnError>
void then(Self* self, F&& f, OnError&& g) const { void then(Self* self, F&& f, OnError&& g) const {
CAF_LOG_TRACE(CAF_ARG(ids_));
auto bhvr = make_behavior(std::forward<F>(f), std::forward<OnError>(g)); auto bhvr = make_behavior(std::forward<F>(f), std::forward<OnError>(g));
for (auto id : ids_) for (auto id : ids_)
self->add_multiplexed_response_handler(id, bhvr); self->add_multiplexed_response_handler(id, bhvr);
...@@ -176,6 +182,7 @@ public: ...@@ -176,6 +182,7 @@ public:
template <class Self, class F, class G> template <class Self, class F, class G>
void receive(Self* self, F&& f, G&& g) const { void receive(Self* self, F&& f, G&& g) const {
CAF_LOG_TRACE(CAF_ARG(ids_));
using helper_type = detail::fan_in_responses_helper_t<detail::decay_t<F>>; using helper_type = detail::fan_in_responses_helper_t<detail::decay_t<F>>;
helper_type helper{ids_.size(), std::forward<F>(f)}; helper_type helper{ids_.size(), std::forward<F>(f)};
auto error_handler = [&](error& err) { auto error_handler = [&](error& err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment