Commit 655ea2fd authored by Dominik Charousset's avatar Dominik Charousset

Fix timeout handling in blocking_actor, close #521

parent a6b7d52c
......@@ -320,7 +320,7 @@ void blocking_actor::receive_impl(receive_cond& rcc,
// reset the timeout each iteration
if (!seq.await_value(true)) {
// short-circuit "loop body"
bhvr.nested.handle_timeout();
bhvr.handle_timeout();
if (!rcc.post())
return;
continue;
......@@ -379,7 +379,7 @@ void blocking_actor::receive_impl(receive_cond& rcc,
}
} while (skipped && !timed_out);
if (timed_out)
bhvr.nested.handle_timeout();
bhvr.handle_timeout();
else
seq.erase_and_advance();
// check loop post condition
......
......@@ -70,4 +70,15 @@ CAF_TEST(behavior_ref) {
self->receive(bhvr);
}
CAF_TEST(timeout_in_scoped_actor) {
bool timeout_called = false;
scoped_actor self{system};
self->receive(
after(std::chrono::milliseconds(20)) >> [&] {
timeout_called = true;
}
);
CAF_CHECK(timeout_called);
}
CAF_TEST_FIXTURE_SCOPE_END()
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