Commit face0cb7 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Fix invalid iterator bug in response multiplexing

parent 33ff479f
......@@ -476,13 +476,14 @@ invoke_message_result scheduled_actor::consume(mailbox_element& x) {
// neither awaited nor multiplexed, probably an expired timeout
if (mrh == multiplexed_responses_.end())
return im_dropped;
if (!invoke(this, mrh->second, x)) {
auto bhvr = std::move(mrh->second);
multiplexed_responses_.erase(mrh);
if (!invoke(this, bhvr, x)) {
// try again with error if first attempt failed
auto msg = make_message(make_error(sec::unexpected_response,
x.move_content_to_message()));
mrh->second(msg);
bhvr(msg);
}
multiplexed_responses_.erase(mrh);
return im_success;
}
// Dispatch on the content of x.
......
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