Skip to content

Commit

Permalink
turn_sock: fix rebase of rfc6544, pass correct size to callback
Browse files Browse the repository at this point in the history
Else, on_data_sent will never be correct and upper layer will wait
forever on a packet already sent

Change-Id: Ida7b5191297ccac071c4306e5a29e00fed0829cf
  • Loading branch information
Sébastien Blin committed Oct 19, 2023
1 parent deeea7c commit 311bd01
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pjnath/src/pjnath/turn_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,12 +979,7 @@ static pj_bool_t on_data_sent(pj_turn_sock *turn_sock,
}

if (turn_sock->cb.on_data_sent) {
pj_ssize_t header_len, sent_size;

/* Remove the length of packet header from sent size. */
header_len = turn_sock->pkt_len - turn_sock->body_len;
sent_size = (sent > header_len)? (sent - header_len) : 0;
(*turn_sock->cb.on_data_sent)(turn_sock, sent_size);
(*turn_sock->cb.on_data_sent)(turn_sock, sent);
}

return PJ_TRUE;
Expand Down

0 comments on commit 311bd01

Please sign in to comment.