Fixed #1577: assertion when TURN session is already destroyed

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@4207 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Sauw Ming 2012-07-17 12:45:39 +00:00
parent 14dfc0e48b
commit dfda40baee
1 changed files with 11 additions and 0 deletions

View File

@ -211,6 +211,7 @@ static void destroy(pj_turn_sock *turn_sock)
}
if (turn_sock->active_sock) {
pj_activesock_set_user_data(turn_sock->active_sock, NULL);
pj_activesock_close(turn_sock->active_sock);
turn_sock->active_sock = NULL;
}
@ -463,6 +464,16 @@ static pj_bool_t on_connect_complete(pj_activesock_t *asock,
pj_turn_sock *turn_sock;
turn_sock = (pj_turn_sock*) pj_activesock_get_user_data(asock);
if (!turn_sock)
return PJ_FALSE;
/* TURN session may have already been destroyed here.
* See ticket #1557 (http://trac.pjsip.org/repos/ticket/1557).
*/
if (!turn_sock->sess) {
sess_fail(turn_sock, "TURN session already destroyed", status);
return PJ_FALSE;
}
if (status != PJ_SUCCESS) {
sess_fail(turn_sock, "TCP connect() error", status);