[reSIProcate] SipStack::send: clone vs new

Scott Godin sgodin at sipspectrum.com
Thu Nov 4 11:39:42 CDT 2010


Thanks Kennard!  I agree with your analysis - using clone is definitely more
flexible.  I'll also change from dynamic_cast to static_cast.

Scott

On Wed, Nov 3, 2010 at 1:14 AM, Kennard White <kennard_white at logitech.com>wrote:

> 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
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20101104/530e7980/attachment.htm>


More information about the resiprocate-devel mailing list