Commit d975b20f authored by Dominik Charousset's avatar Dominik Charousset

Cleanup stream states on exit

parent 330a89ef
......@@ -185,12 +185,22 @@ void scheduled_actor::launch(execution_unit* eu, bool lazy, bool hide) {
}
bool scheduled_actor::cleanup(error&& fail_state, execution_unit* host) {
// Shutdown hosting thread when running detached.
if (getf(is_detached_flag)) {
CAF_ASSERT(private_thread_ != nullptr);
private_thread_->shutdown();
}
// Discard any state for pending `request` messages.
awaited_responses_.clear();
multiplexed_responses_.clear();
// Abort any open stream.
for (auto& kvp : streams_) {
strong_actor_ptr dummy;
auto err = fail_state;
kvp.second->abort(dummy, err);
}
streams_.clear();
// Dispatch to parent's `cleanup` function.
return local_actor::cleanup(std::move(fail_state), host);
}
......
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