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

Fix termination issue in OpenSSL test

parent f7a7510a
......@@ -174,6 +174,10 @@ struct fixture {
auto s = &sys == &server_side ? ssched : csched;
s->after_next_enqueue([=] { exec_loop(); });
}
bool terminated(const actor& x) {
return x ? x->getf(abstract_actor::is_terminated_flag) : false;
}
};
} // namespace <anonymous>
......@@ -183,15 +187,15 @@ CAF_TEST_FIXTURE_SCOPE(authentication, fixture)
using openssl::remote_actor;
using openssl::publish;
CAF_TEST(authentication_succes) {
CAF_TEST(authentication_success) {
if (!init(false))
return;
// server side
CAF_MESSAGE("spawn pong on server");
auto spong = server_side.spawn(make_pong_behavior);
exec_loop();
loop_after_next_enqueue(server_side);
CAF_MESSAGE("publish pong");
loop_after_next_enqueue(server_side);
CAF_EXP_THROW(port, publish(spong, 0, local_host));
exec_loop();
// client side
......@@ -199,7 +203,8 @@ CAF_TEST(authentication_succes) {
loop_after_next_enqueue(client_side);
CAF_EXP_THROW(pong, remote_actor(client_side, local_host, port));
CAF_MESSAGE("spawn ping and exchange messages");
client_side.spawn(make_ping_behavior, pong);
auto sping = client_side.spawn(make_ping_behavior, pong);
while (!terminated(sping))
exec_loop();
CAF_MESSAGE("terminate pong");
anon_send_exit(spong, exit_reason::user_shutdown);
......
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