Commit 216d1fae authored by Dominik Charousset's avatar Dominik Charousset

Reformat test_remote_actor

parent b8b9faae
......@@ -32,20 +32,18 @@ void reflector(event_based_actor* self) {
}
void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
CAF_LOGF_TRACE(CAF_TARG(client, to_string) << ", "
<< CAF_TARG(grp, to_string));
CAF_LOGF_TRACE(CAF_TARG(client, to_string)
<< ", " << CAF_TARG(grp, to_string));
CAF_CHECK(grp != invalid_group);
self->spawn_in_group(grp, reflector);
self->spawn_in_group(grp, reflector);
CAF_PRINT("send {'Spawn5'} and await {'ok', actor_vector}");
self->sync_send(client, atom("Spawn5"), grp)
.then(on(atom("ok"), arg_match) >> [=](const actor_vector& vec) {
CAF_PRINT("received vector with " << vec.size()
<< " elements");
self->sync_send(client, atom("Spawn5"), grp).then(
on(atom("ok"), arg_match) >> [=](const actor_vector& vec) {
CAF_PRINT("received vector with " << vec.size() << " elements");
self->send(grp, "Hello reflectors!", 5.0);
if (vec.size() != 5) {
CAF_PRINTERR(
"remote client did not spawn five reflectors!");
CAF_PRINTERR("remote client did not spawn five reflectors!");
}
for (auto& a : vec) {
CAF_PRINT("monitor actor: " << to_string(a));
......@@ -54,13 +52,13 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
},
others() >> [=] {
CAF_UNEXPECTED_MSG(self);
self->quit(exit_reason::unhandled_exception);
self->quit(exit_reason::user_defined);
},
after(chrono::seconds(10)) >> [=] {
CAF_UNEXPECTED_TOUT();
self->quit(exit_reason::unhandled_exception);
})
.continue_with([=] {
self->quit(exit_reason::user_defined);
}
).continue_with([=] {
CAF_PRINT("wait for reflected messages");
// receive seven reply messages (2 local, 5 remote)
auto replies = std::make_shared<int>(0);
......@@ -72,9 +70,7 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
self->become(
[=](const down_msg& dm) {
if (dm.reason != exit_reason::normal) {
CAF_PRINTERR(
"reflector exited for non-normal exit "
"reason!");
CAF_PRINTERR("reflector exited for non-normal exit reason!");
}
if (++*downs == 5) {
CAF_CHECKPOINT();
......@@ -84,23 +80,23 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
},
others() >> [=] {
CAF_UNEXPECTED_MSG(self);
// self->quit(exit_reason::unhandled_exception);
self->quit(exit_reason::user_defined);
},
after(chrono::seconds(2)) >> [=] {
CAF_UNEXPECTED_TOUT();
CAF_LOGF_ERROR("did only receive "
<< *downs << " down messages");
// self->quit(exit_reason::unhandled_exception);
});
CAF_LOGF_ERROR("did only receive " << *downs << " down messages");
self->quit(exit_reason::user_defined);
}
);
}
},
after(std::chrono::seconds(2)) >> [=] {
CAF_UNEXPECTED_TOUT();
CAF_LOGF_ERROR("did only receive "
<< *replies
CAF_LOGF_ERROR("did only receive " << *replies
<< " responses to 'Hello reflectors!'");
// self->quit(exit_reason::unhandled_exception);
});
self->quit(exit_reason::user_defined);
}
);
});
}
......
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