Commit dc4cca20 authored by Dominik Charousset's avatar Dominik Charousset

fixed bug in io::broker::servant::dispose

parent 18a8a666
...@@ -188,9 +188,10 @@ class behavior_stack_based : public Base { ...@@ -188,9 +188,10 @@ class behavior_stack_based : public Base {
} }
inline void handle_timeout(behavior& bhvr, std::uint32_t timeout_id) { inline void handle_timeout(behavior& bhvr, std::uint32_t timeout_id) {
CPPA_REQUIRE(m_timeout_id == timeout_id); if (timeout_id == m_timeout_id) {
m_has_timeout = false; m_has_timeout = false;
bhvr.handle_timeout(); bhvr.handle_timeout();
}
} }
protected: protected:
......
...@@ -119,11 +119,12 @@ class broker::servant : public continuable { ...@@ -119,11 +119,12 @@ class broker::servant : public continuable {
} }
void dispose() override { void dispose() override {
m_broker->erase_io(read_handle()); auto ptr = m_broker;
if (m_broker->m_io.empty() && m_broker->m_accept.empty()) { ptr->erase_io(read_handle());
if (ptr->m_io.empty() && ptr->m_accept.empty()) {
// release implicit reference count held by middleman // release implicit reference count held by middleman
// in caes no reader/writer is left for this broker // in caes no reader/writer is left for this broker
m_broker->deref(); ptr->deref();
} }
} }
......
...@@ -180,11 +180,11 @@ int main(int argc, char** argv) { ...@@ -180,11 +180,11 @@ int main(int argc, char** argv) {
await_all_actors_done(); await_all_actors_done();
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
shutdown(); shutdown();
return CPPA_TEST_RESULT();
} }
catch (bind_failure&) { catch (bind_failure&) {
// try next port // try next port
++port; ++port;
} }
} }
return CPPA_TEST_RESULT();
} }
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