Changeset 3028 for pjproject/trunk/pjnath/src/pjnath/turn_session.c
- Timestamp:
- Dec 8, 2009 1:11:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_session.c
r2774 r3028 462 462 * Forcefully destroy the TURN session. 463 463 */ 464 PJ_DEF(pj_status_t) pj_turn_session_destroy( pj_turn_session *sess) 464 PJ_DEF(pj_status_t) pj_turn_session_destroy( pj_turn_session *sess, 465 pj_status_t last_err) 465 466 { 466 467 PJ_ASSERT_RETURN(sess, PJ_EINVAL); 467 468 469 if (last_err != PJ_SUCCESS && sess->last_status == PJ_SUCCESS) 470 sess->last_status = last_err; 468 471 set_state(sess, PJ_TURN_STATE_DEALLOCATED); 469 472 sess_shutdown(sess, PJ_SUCCESS); … … 960 963 PJ_FALSE, PJ_FALSE); 961 964 if (ch && ch->num != PJ_TURN_INVALID_CHANNEL && ch->bound) { 965 unsigned total_len; 966 962 967 /* Peer is assigned a channel number, we can use ChannelData */ 963 968 pj_turn_channel_data *cd = (pj_turn_channel_data*)sess->tx_pkt; … … 965 970 pj_assert(sizeof(*cd)==4); 966 971 967 if (pkt_len > sizeof(sess->tx_pkt)-sizeof(*cd)) { 972 /* Calculate total length, including paddings */ 973 total_len = (pkt_len + sizeof(*cd) + 3) & (~3); 974 if (total_len > sizeof(sess->tx_pkt)) { 968 975 status = PJ_ETOOBIG; 969 976 goto on_return; … … 976 983 pj_assert(sess->srv_addr != NULL); 977 984 978 status = sess->cb.on_send_pkt(sess, sess->tx_pkt, pkt_len+sizeof(*cd),985 status = sess->cb.on_send_pkt(sess, sess->tx_pkt, total_len, 979 986 sess->srv_addr, 980 987 pj_sockaddr_get_len(sess->srv_addr)); … … 1157 1164 } else { 1158 1165 if (parsed_len) { 1159 *parsed_len = cd.length + sizeof(cd); 1166 /* Apply padding too */ 1167 *parsed_len = ((cd.length + 3) & (~3)) + sizeof(cd); 1160 1168 } 1161 1169 }
Note: See TracChangeset
for help on using the changeset viewer.