Changeset 5420
- Timestamp:
- Aug 17, 2016 4:29:17 AM (8 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
r5349 r5420 20 20 #include <pjlib-util/resolver.h> 21 21 #include <pjlib-util/errno.h> 22 #include <pj/compat/socket.h> 22 23 #include <pj/assert.h> 23 24 #include <pj/ctype.h> … … 310 311 status = pj_sock_socket(pj_AF_INET6(), pj_SOCK_DGRAM(), 0, 311 312 &resv->udp6_sock); 312 if (status != PJ_SUCCESS) 313 if (status != PJ_SUCCESS) { 314 /* Skip IPv6 socket on system without IPv6 (see ticket #1953) */ 315 if (status == PJ_STATUS_FROM_OS(OSERR_EAFNOSUPPORT)) { 316 PJ_LOG(3,(resv->name.ptr, 317 "System does not support IPv6, resolver will " 318 "ignore any IPv6 nameservers")); 319 return PJ_SUCCESS; 320 } 313 321 return status; 322 } 314 323 315 324 /* Bind to any address/port */ … … 651 660 { 652 661 unsigned pkt_size; 653 unsigned i, server_cnt ;662 unsigned i, server_cnt, send_cnt; 654 663 unsigned servers[PJ_DNS_RESOLVER_MAX_NS]; 655 664 pj_time_val now; … … 686 695 if (pj_ioqueue_is_pending(resolver->udp_key, &resolver->udp_op_tx_key) 687 696 #if PJ_HAS_IPV6 688 || pj_ioqueue_is_pending(resolver->udp6_key, 689 &resolver->udp6_op_tx_key) 697 || (resolver->udp6_key && 698 pj_ioqueue_is_pending(resolver->udp6_key, 699 &resolver->udp6_op_tx_key)) 690 700 #endif 691 701 ) … … 715 725 716 726 /* Send the packet to name servers */ 727 send_cnt = 0; 717 728 for (i=0; i<server_cnt; ++i) { 718 729 char addr[PJ_INET6_ADDRSTRLEN]; … … 726 737 &ns->addr, 727 738 pj_sockaddr_get_len(&ns->addr)); 739 if (status == PJ_SUCCESS || status == PJ_EPENDING) 740 send_cnt++; 728 741 } 729 742 #if PJ_HAS_IPV6 730 else {743 else if (resolver->udp6_key) { 731 744 status = pj_ioqueue_sendto(resolver->udp6_key, 732 745 &resolver->udp6_op_tx_key, … … 734 747 &ns->addr, 735 748 pj_sockaddr_get_len(&ns->addr)); 749 if (status == PJ_SUCCESS || status == PJ_EPENDING) 750 send_cnt++; 736 751 } 737 752 #endif 753 else { 754 continue; 755 } 738 756 739 757 PJ_PERROR(4,(resolver->name.ptr, status, … … 751 769 } 752 770 } 771 772 if (send_cnt == 0) 773 return PJLIB_UTIL_EDNSNOWORKINGNS; 753 774 754 775 ++q->transmit_cnt; -
pjproject/trunk/pjlib/include/pj/compat/socket.h
r5312 r5420 159 159 # define OSERR_ECONNRESET WSAECONNRESET 160 160 # define OSERR_ENOTCONN WSAENOTCONN 161 # define OSERR_EAFNOSUPPORT WSAEAFNOSUPPORT 161 162 #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 162 163 # define OSERR_EWOULDBLOCK -1 … … 164 165 # define OSERR_ECONNRESET -1 165 166 # define OSERR_ENOTCONN -1 167 # define OSERR_EAFNOSUPPORT -1 166 168 #else 167 169 # define OSERR_EWOULDBLOCK EWOULDBLOCK … … 169 171 # define OSERR_ECONNRESET ECONNRESET 170 172 # define OSERR_ENOTCONN ENOTCONN 173 # define OSERR_EAFNOSUPPORT EAFNOSUPPORT 171 174 #endif 172 175
Note: See TracChangeset
for help on using the changeset viewer.