diff --git a/src/client.cpp b/src/client.cpp index d525538..9480977 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1367,6 +1367,8 @@ void ContextImpl::cacheClean(const std::string& name, Context::cacheAction actio // explicitly break ref. loop of channel cache chanByName.erase(cur); + if(chanByCID.erase(trash->cid)!=1) + log_crit_printf(io, "Inconsistent chanByName vs. chanByCID for %s\n", trash->name.c_str()); if(action==Context::Disconnect) { trash->disconnect(trash); @@ -1374,6 +1376,11 @@ void ContextImpl::cacheClean(const std::string& name, Context::cacheAction actio } } } + + if(chanByName.size() != chanByCID.size()) { + log_crit_printf(io, "Inconsistent sizes chanByName %zu vs. chanByCID %zu", + chanByName.size(), chanByCID.size()); + } } void ContextImpl::cacheCleanS(evutil_socket_t fd, short evt, void *raw) diff --git a/test/testput.cpp b/test/testput.cpp index c13c4e9..1c9d8d2 100644 --- a/test/testput.cpp +++ b/test/testput.cpp @@ -90,7 +90,7 @@ struct Tester : public TesterBase } op.reset(); - cli.cacheClear(); + cli.cacheClear("", client::Context::Disconnect); } void loopback(bool get)