Changeset 5337 for pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
- Timestamp:
- Jun 8, 2016 2:49:56 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
r5311 r5337 196 196 struct query *query; 197 197 pjsip_transport_type_e type = target->type; 198 int af = pj_AF_UNSPEC(); 198 199 199 200 /* If an external implementation has been provided use it instead */ … … 205 206 /* Is it IP address or hostname? And if it's an IP, which version? */ 206 207 ip_addr_ver = get_ip_addr_ver(&target->addr.host); 208 209 /* Initialize address family type */ 210 if ((ip_addr_ver == 6) || (type & PJSIP_TRANSPORT_IPV6)) 211 af = pj_AF_INET6(); 212 else if (ip_addr_ver == 4) 213 af = pj_AF_INET(); 207 214 208 215 /* Set the transport type if not explicitly specified. … … 242 249 } 243 250 } 244 245 /* Add IPv6 flag for IPv6 address */246 if (ip_addr_ver == 6)247 type = (pjsip_transport_type_e)((int)type + PJSIP_TRANSPORT_IPV6);248 251 } 249 252 … … 272 275 pj_addrinfo ai; 273 276 unsigned count; 274 int af;275 277 276 278 PJ_LOG(5,(THIS_FILE, … … 281 283 target->addr.port, 282 284 pjsip_transport_get_type_name(target->type))); 283 284 if (type & PJSIP_TRANSPORT_IPV6) {285 af = pj_AF_INET6();286 } else {287 af = pj_AF_INET();288 }289 285 290 286 /* Resolve */ … … 300 296 } 301 297 302 svr_addr.entry[0].addr.addr.sa_family = (pj_uint16_t)af;303 pj_memcpy(&svr_addr.entry[0].addr, &ai.ai_addr,304 sizeof(pj_sockaddr));298 pj_sockaddr_cp(&svr_addr.entry[0].addr, &ai.ai_addr); 299 if (af == pj_AF_UNSPEC()) 300 af = ai.ai_addr.addr.sa_family; 305 301 } 302 303 /* After address resolution, update IPv6 bitflag in transport type. */ 304 if (af == pj_AF_INET6()) 305 type |= PJSIP_TRANSPORT_IPV6; 306 306 307 307 /* Set the port number */
Note: See TracChangeset
for help on using the changeset viewer.