[reSIProcate] Unnecessary loop in TransportSelector.cxx
Scott Godin
sgodin at sipspectrum.com
Wed Sep 26 13:01:14 CDT 2018
That is true. On the other hand, it's harmless to just leave it as is too.
Scott
On Wed, Sep 26, 2018 at 12:24 AM Karlsson <boost.regex at gmail.com> wrote:
> In TransportSelector::transmit, I think below loop can be removed:
>
> if (msg->exists(h_Contacts) && msg->header(h_Contacts).size()==1)
> {
> // This loop can be removed since we already detected the contact size is
> 1, simply use front of the contacts list is enough, don't know how to send
> the PR on github.
>
> for (NameAddrs::iterator i=msg->header(h_Contacts).begin(); i
> != msg->header(h_Contacts).end(); i++)
> {
> const NameAddr& c_contact = *i;
> NameAddr& contact = *i;
> // No host specified, so use the ip address and port of the
> // transport used. Otherwise, leave it as is.
> if (c_contact.uri().host().empty())
> {
> contact.uri().host() = (transport->hasSpecificContact()
> ?
> transport->interfaceName() :
> Tuple::inet_ntop(source) );
> contact.uri().port() = transport->port();
>
> if (transport->transport() != UDP &&
> !contact.uri().exists(p_gr))
> {
> contact.uri().param(p_transport) =
> Tuple::toDataLower(transport->transport());
> }
>
> // Add comp=sigcomp to contact URI
> // Also, If no +sip.instance on contact HEADER,
> // add sigcomp-id="<urn>" to contact URI.
> if (mCompression.isEnabled())
> {
> if (!contact.uri().exists(p_comp))
> {
> contact.uri().param(p_comp) = "sigcomp";
> }
> if (!contact.exists(p_Instance) &&
> !contact.uri().exists(p_sigcompId))
> {
> contact.uri().param(p_sigcompId) =
> mCompression.getSigcompId();
> }
> }
> }
> else
> {
> if (c_contact.uri().exists(p_addTransport))
> {
> if (target.getType() != UDP)
> {
> contact.uri().param(p_transport) =
> Tuple::toDataLower(target.getType());
> }
> contact.uri().remove(p_addTransport);
> }
> }
> }
> }
> _______________________________________________
> 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/20180926/8d49c75f/attachment.htm>
More information about the resiprocate-devel
mailing list