[reSIProcate] More problems with `assert'
I occasionally see this piece of code causing trouble, assert at
approximately line 1166 of DialogUsageManager.cxx (see code below).
Is it satisfactory to change the `assert' to something less
catastrophic, like this for example:
#include <typeinfo>
...
if(dynamic_cast<SipMessage*>(msg.get()) == 0)
{
ErrorLog(<< "discarding message of type " <<
typeid(*(msg.get())).name() <<", transaction gone away perhaps?");
msg.release();
return;
}
// From DialogUsageManager.cxx:
if (tid != Data::Empty && !mIncomingFeatureList.empty())
{
FeatureChainMap::iterator it;
//efficiently find or create FeatureChain, should prob. be a
utility template
{
FeatureChainMap::iterator lb =
mIncomingFeatureChainMap.lower_bound(tid);
if (lb != mIncomingFeatureChainMap.end() &&
!(mIncomingFeatureChainMap.key_comp()(tid, lb->first)))
{
it = lb;
}
else
{
assert(dynamic_cast<SipMessage*>(msg.get()));
it = mIncomingFeatureChainMap.insert(lb,
FeatureChainMap::value_type(tid, new DumFeatureChain(*this,
mIncomingFeatureList, *mIncomingTarget)));
}
}
DumFeatureChain::ProcessingResult res =
it->second->process(msg.get());