Commit 95345f1b authored by Dominik Charousset's avatar Dominik Charousset

Properly handle discarded socket managers

parent cc2050ac
...@@ -120,8 +120,8 @@ void multiplexer::register_reading(const socket_manager_ptr& mgr) { ...@@ -120,8 +120,8 @@ void multiplexer::register_reading(const socket_manager_ptr& mgr) {
if (shutting_down_) { if (shutting_down_) {
// discard // discard
} else if (mgr->mask() != operation::none) { } else if (mgr->mask() != operation::none) {
CAF_ASSERT(index_of(mgr) != -1); if (auto index = index_of(mgr);
if (mgr->mask_add(operation::read)) { index != -1 && mgr->mask_add(operation::read)) {
auto& fd = pollset_[index_of(mgr)]; auto& fd = pollset_[index_of(mgr)];
fd.events |= input_mask; fd.events |= input_mask;
} }
...@@ -139,8 +139,8 @@ void multiplexer::register_writing(const socket_manager_ptr& mgr) { ...@@ -139,8 +139,8 @@ void multiplexer::register_writing(const socket_manager_ptr& mgr) {
if (shutting_down_) { if (shutting_down_) {
// discard // discard
} else if (mgr->mask() != operation::none) { } else if (mgr->mask() != operation::none) {
CAF_ASSERT(index_of(mgr) != -1); if (auto index = index_of(mgr);
if (mgr->mask_add(operation::write)) { index != -1 && mgr->mask_add(operation::write)) {
auto& fd = pollset_[index_of(mgr)]; auto& fd = pollset_[index_of(mgr)];
fd.events |= output_mask; fd.events |= output_mask;
} }
......
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