Changeset 4343 for pjproject/trunk/pjnath/src/pjnath/turn_sock.c
- Timestamp:
- Feb 7, 2013 9:35:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_sock.c
r4207 r4343 33 33 }; 34 34 35 36 enum { MAX_BIND_RETRY = 100 }; 37 38 35 39 #define INIT 0x1FFFFFFF 36 40 … … 103 107 } 104 108 109 105 110 /* 106 111 * Create. … … 726 731 pj_sock_t sock; 727 732 pj_activesock_cb asock_cb; 733 pj_sockaddr bound_addr, *cfg_bind_addr; 734 pj_uint16_t max_bind_retry; 728 735 729 736 /* Close existing connection, if any. This happens when … … 751 758 } 752 759 753 /* Apply QoS, if specified */ 760 /* Bind socket */ 761 cfg_bind_addr = &turn_sock->setting.bound_addr; 762 max_bind_retry = MAX_BIND_RETRY; 763 if (turn_sock->setting.port_range && 764 turn_sock->setting.port_range < max_bind_retry) 765 { 766 max_bind_retry = turn_sock->setting.port_range; 767 } 768 pj_sockaddr_init(turn_sock->af, &bound_addr, NULL, 0); 769 if (cfg_bind_addr->addr.sa_family == pj_AF_INET() || 770 cfg_bind_addr->addr.sa_family == pj_AF_INET6()) 771 { 772 pj_sockaddr_cp(&bound_addr, cfg_bind_addr); 773 } 774 status = pj_sock_bind_random(sock, &bound_addr, 775 turn_sock->setting.port_range, 776 max_bind_retry); 777 if (status != PJ_SUCCESS) { 778 pj_turn_sock_destroy(turn_sock); 779 return; 780 } 781 782 /* Apply QoS, if specified */ 754 783 status = pj_sock_apply_qos2(sock, turn_sock->setting.qos_type, 755 784 &turn_sock->setting.qos_params,
Note: See TracChangeset
for help on using the changeset viewer.