Commit 79d51c9d authored by Dominik Charousset's avatar Dominik Charousset

Fix bug in testing DSL's next_mailbox_element

The function next_mailbox_element did not deal with blocked actors
correctly, causing hard-to-understand errors in unit tests.
parent 907e3a73
...@@ -205,11 +205,12 @@ private: ...@@ -205,11 +205,12 @@ private:
inline caf::mailbox_element* next_mailbox_element(caf_handle x) { inline caf::mailbox_element* next_mailbox_element(caf_handle x) {
CAF_ASSERT(x.get() != nullptr); CAF_ASSERT(x.get() != nullptr);
auto sptr = dynamic_cast<caf::scheduled_actor*>(x.get()); auto sptr = dynamic_cast<caf::scheduled_actor*>(x.get());
if (sptr != nullptr) if (sptr != nullptr) {
return sptr->mailbox().peek(); return sptr->mailbox().blocked() ? nullptr : sptr->mailbox().peek();
}
auto bptr = dynamic_cast<caf::blocking_actor*>(x.get()); auto bptr = dynamic_cast<caf::blocking_actor*>(x.get());
CAF_ASSERT(bptr != nullptr); CAF_ASSERT(bptr != nullptr);
return bptr->mailbox().peek(); return bptr->mailbox().blocked() ? nullptr : bptr->mailbox().peek();
} }
// -- introspection of the next mailbox element -------------------------------- // -- introspection of the next mailbox element --------------------------------
......
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