- Timestamp:
- Jun 21, 2008 2:13:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r2031 r2043 122 122 pj_stun_sock *stun_sock; /**< STUN transport. */ 123 123 pj_turn_sock *turn_sock; /**< TURN relay transport. */ 124 pj_bool_t turn_log_off; /**< TURN loggin off? */ 124 125 125 126 unsigned cand_cnt; /**< # of candidates/aliaes. */ … … 663 664 "component %d", i+1)); 664 665 pj_turn_sock_set_log(comp->turn_sock, 0xFFFF); 666 comp->turn_log_off = PJ_FALSE; 665 667 } 666 668 … … 909 911 pj_ssize_t pkt_size; 910 912 pj_ice_strans_comp *comp; 913 unsigned def_cand; 911 914 pj_status_t status; 912 915 … … 916 919 comp = ice_st->comp[comp_id-1]; 917 920 918 /* If ICE is available, send data with ICE */ 921 /* Check that default candidate for the component exists */ 922 def_cand = comp->default_cand; 923 if (def_cand >= comp->cand_cnt) 924 return PJ_EINVALIDOP; 925 926 /* If ICE is available, send data with ICE, otherwise send with the 927 * default candidate selected during initialization. 928 */ 919 929 if (ice_st->ice) { 920 930 if (comp->turn_sock) { … … 927 937 return status; 928 938 929 } else if (comp->stun_sock) { 930 931 pkt_size = data_len; 932 status = pj_stun_sock_sendto(comp->stun_sock, NULL, data, data_len, 933 0, dst_addr, dst_addr_len); 934 return (status==PJ_SUCCESS||status==PJ_EPENDING) ? PJ_SUCCESS : status; 939 } else if (comp->cand_list[def_cand].status == PJ_SUCCESS) { 940 941 if (comp->cand_list[def_cand].type == PJ_ICE_CAND_TYPE_RELAYED) { 942 943 enum { 944 msg_disable_ind = 0xFFFF & 945 ~(PJ_STUN_SESS_LOG_TX_IND| 946 PJ_STUN_SESS_LOG_RX_IND) 947 }; 948 949 if (!comp->turn_log_off) { 950 /* Disable logging for Send/Data indications */ 951 PJ_LOG(5,(ice_st->obj_name, 952 "Disabling STUN Indication logging for " 953 "component %d", comp->comp_id)); 954 pj_turn_sock_set_log(comp->turn_sock, msg_disable_ind); 955 comp->turn_log_off = PJ_TRUE; 956 } 957 958 status = pj_turn_sock_sendto(comp->turn_sock, data, data_len, 959 dst_addr, dst_addr_len); 960 return (status==PJ_SUCCESS||status==PJ_EPENDING) ? 961 PJ_SUCCESS : status; 962 } else { 963 pkt_size = data_len; 964 status = pj_stun_sock_sendto(comp->stun_sock, NULL, data, 965 data_len, 0, dst_addr, dst_addr_len); 966 return (status==PJ_SUCCESS||status==PJ_EPENDING) ? 967 PJ_SUCCESS : status; 968 } 935 969 936 970 } else … … 993 1027 pj_turn_sock_set_log(ice_st->comp[i]->turn_sock, 994 1028 msg_disable_ind); 1029 ice_st->comp[i]->turn_log_off = PJ_TRUE; 995 1030 } 996 1031
Note: See TracChangeset
for help on using the changeset viewer.