Skip to content

Commit

Permalink
turn_sock: don't try to use a socket that's being deleted
Browse files Browse the repository at this point in the history
Change-Id: Ia94af25b9be9c9acdb0287674e533c1f72a4a5db
  • Loading branch information
François-Simon Fauteux-Chapleau committed Apr 12, 2024
1 parent e12ea3b commit 797f1a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pjnath/src/pjnath/turn_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,14 @@ static pj_bool_t dataconn_on_connect_complete(pj_activesock_t *asock,

pj_grp_lock_acquire(turn_sock->grp_lock);

if (pj_turn_sock_get_user_data(turn_sock) == NULL) {
// It's possible for a TURN socket to be destroyed by ice_close_remaining_tcp
// after the on_connect_complete event has been put into an ioqueue, but
// before the callback is actually called, so we need to check for this.
PJ_LOG(4,(turn_sock->obj_name, "Socket is being destroyed, can't be used to establish a data connection"));
status = PJ_ECANCELLED;
}

if (status == PJ_SUCCESS) {
status = pj_activesock_start_read(asock, turn_sock->pool,
turn_sock->setting.max_pkt_size, 0);
Expand Down

0 comments on commit 797f1a3

Please sign in to comment.