client track opByIOID per channel

needed to handle CMD_DESTROY_CHANNEL
This commit is contained in:
Michael Davidsaver
2020-03-01 19:57:13 -08:00
parent 1f91eb9e5d
commit e668038250
5 changed files with 21 additions and 6 deletions
+6 -1
View File
@@ -141,6 +141,7 @@ void Connection::cleanup()
auto op = pair.second.handle.lock();
if(!op)
continue;
op->chan->opByIOID.erase(op->ioid);
op->disconnected(op);
}
@@ -360,7 +361,11 @@ void Connection::handle_DESTROY_CHANNEL()
self = std::move(chan->conn);
context->searchBuckets[context->currentBucket].push_back(chan);
// TODO: disconnect Operations
for(auto& pair : chan->opByIOID) {
auto op = pair.second->handle.lock();
opByIOID.erase(pair.first); // invalidates pair.second
op->disconnected(op);
}
log_debug_printf(io, "Server %s destroys channel '%s' %u:%u\n",
peerName.c_str(), chan->name.c_str(), unsigned(cid), unsigned(sid));