[reSIProcate] SipStack::send: clone vs new

Kennard White kennard_white at logitech.com
Wed Nov 3 00:14:26 CDT 2010


Hi,

I found an inconsistency between the various flavors of SipStack:send().
Hoping someone can explain...

The method SipStack::send(const SipMessage&msg, TransactionUser* tu) calls:
    new SipMessage(msg)

while the corresponding sendTo(..., const Tuple&, ...) method calls:
    dynamic_cast<SipMessage*>(msg.clone())

Seems like the 2nd method should be used everywhere so that the class of the
SipMessage is preserved. In particular, to preserve the subclassed
KeepAliveMessage. When duplicated via new(), the class is lost and the
special encoder method is lost.

Looking at the above, why is dynamic_cast used? The result isn't NULL
checked, so might as well use static_cast I would think. Not sure what I'm
missing.

Thanks,
Kennard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20101102/da00f543/attachment.htm>


More information about the resiprocate-devel mailing list