[asterisk-scf-commits] asterisk-scf/release/pjproject.git branch "veesix" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Nov 22 17:29:02 CST 2010


branch "veesix" has been updated
       via  8f90f061528ea7be26af518c0683650a69acd306 (commit)
      from  9e646bf5feb08626df79ac200bfedba4d9a426cc (commit)

Summary of changes:
 pjsip/src/pjsip/sip_transport_tcp.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)


- Log -----------------------------------------------------------------
commit 8f90f061528ea7be26af518c0683650a69acd306
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Nov 22 17:32:35 2010 -0600

    Fix up some lingering XXX comments.
    
    I've made an ... interesting decision here. PJSIP will freely allow
    you to call pjsip_tcp_transport_start() with a NULL pointer for the
    address. This previously had the same effect as binding to 0.0.0.0.
    With this change, I have defaulted the address family to pj_AF_INET6()
    if a NULL pj_sockaddr pointer is received. Why? Because I'm bold.

diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 45bb608..67daa16 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -419,9 +419,9 @@ PJ_DEF(pj_status_t) pjsip_tcp_transport_start2(pjsip_endpoint *endpt,
 					       pjsip_tpfactory **p_factory)
 {
     pjsip_tcp_transport_cfg cfg;
+    pj_uint16_t af = local ? local->addr.sa_family : pj_AF_INET6();
 
-    /* XXX Change family here... */
-    pjsip_tcp_transport_cfg_default(&cfg, pj_AF_INET());
+    pjsip_tcp_transport_cfg_default(&cfg, af);
 
     if (local)
 	pj_sockaddr_cp(&cfg.bind_addr, local);
@@ -838,10 +838,6 @@ static pj_status_t tcp_start_read(struct tcp_transport *tcp)
 }
 
 
-/* XXX Come back to this function when you're thinking more clearly */
-/* This callback is called by transport manager for the TCP factory
- * to create outgoing transport to the specified destination.
- */
 static pj_status_t lis_create_transport(pjsip_tpfactory *factory,
 					pjsip_tpmgr *mgr,
 					pjsip_endpoint *endpt,
@@ -866,17 +862,7 @@ static pj_status_t lis_create_transport(pjsip_tpfactory *factory,
                      (rem_family == pj_AF_INET6() &&
                      addr_len == sizeof(pj_sockaddr_in6)), PJ_EINVAL);
 
-    pj_bzero(&local_addr, sizeof(pj_sockaddr));
-
-    if (rem_family == pj_AF_INET())
-    {
-        local_addr.addr.sa_family = local_addr.ipv4.sin_family = pj_AF_INET();
-    }
-    else
-    {
-        local_addr.addr.sa_family = local_addr.ipv6.sin6_family = pj_AF_INET6();
-    }
-
+    pj_sockaddr_init(rem_family, &local_addr, NULL, 0);
 
     listener = (struct tcp_listener*)factory;
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/pjproject.git



More information about the asterisk-scf-commits mailing list