Changeset 6155
- Timestamp:
- Feb 4, 2020 5:37:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r6108 r6155 137 137 /* Forward decls */ 138 138 static pj_bool_t on_data_sent(pj_ice_strans *ice_st, pj_ssize_t sent); 139 static void check_pending_send(pj_ice_strans *ice_st); 139 140 static void ice_st_on_destroy(void *obj); 140 141 static void destroy_ice_st(pj_ice_strans *ice_st); … … 1630 1631 if (comp->default_cand >= comp->cand_cnt) { 1631 1632 status = PJ_EINVALIDOP; 1632 goto on_return; 1633 if (call_cb) 1634 on_data_sent(ice_st, -status); 1635 return status; 1633 1636 } 1634 1637 … … 1742 1745 on_data_sent(ice_st, (status == PJ_SUCCESS? data_len: -status)); 1743 1746 } else { 1744 pj_grp_lock_acquire(ice_st->grp_lock); 1745 if (ice_st->num_buf > 0) { 1746 ice_st->buf_idx = (ice_st->buf_idx + 1) % ice_st->num_buf; 1747 pj_assert (ice_st->buf_idx == ice_st->empty_idx); 1748 } 1749 ice_st->is_pending = PJ_FALSE; 1750 pj_grp_lock_release(ice_st->grp_lock); 1747 check_pending_send(ice_st); 1751 1748 } 1752 1749 … … 2015 2012 } 2016 2013 2017 /* Notifification when asynchronous send operation via STUN/TURN 2018 * has completed. 2019 */ 2020 static pj_bool_t on_data_sent(pj_ice_strans *ice_st, pj_ssize_t sent) 2021 { 2022 if (ice_st->destroy_req || !ice_st->is_pending) 2023 return PJ_TRUE; 2024 2025 if (ice_st->call_send_cb && ice_st->cb.on_data_sent) { 2026 (*ice_st->cb.on_data_sent)(ice_st, sent); 2027 } 2028 2014 static void check_pending_send(pj_ice_strans *ice_st) 2015 { 2029 2016 pj_grp_lock_acquire(ice_st->grp_lock); 2030 2017 … … 2033 2020 2034 2021 if (ice_st->num_buf > 0 && ice_st->buf_idx != ice_st->empty_idx) { 2035 /* There's s till more pending send. Send it one by one. */2022 /* There's some pending send. Send it one by one. */ 2036 2023 pending_send *ps = &ice_st->send_buf[ice_st->buf_idx]; 2037 2024 … … 2043 2030 pj_grp_lock_release(ice_st->grp_lock); 2044 2031 } 2032 } 2033 2034 /* Notifification when asynchronous send operation via STUN/TURN 2035 * has completed. 2036 */ 2037 static pj_bool_t on_data_sent(pj_ice_strans *ice_st, pj_ssize_t sent) 2038 { 2039 if (ice_st->destroy_req || !ice_st->is_pending) 2040 return PJ_TRUE; 2041 2042 if (ice_st->call_send_cb && ice_st->cb.on_data_sent) { 2043 (*ice_st->cb.on_data_sent)(ice_st, sent); 2044 } 2045 2046 check_pending_send(ice_st); 2045 2047 2046 2048 return PJ_TRUE;
Note: See TracChangeset
for help on using the changeset viewer.