From ecf593ab1b9006b5d0f3b0bd0c17eb69626095c9 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 20 Aug 2009 22:42:29 +0000 Subject: Fixed ticket #953: ICE may find the wrong best candidate (thanks John Ridges for the report) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2905 74dad513-b988-da41-8d7b-12977e46ad98 --- pjnath/src/pjnath/ice_session.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pjnath') diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index 841c74b0..d725b9b0 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -2313,12 +2313,14 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, ice->valid_list.checks[i].nominated = check->nominated; } - /* Sort valid_list */ - sort_checklist(&ice->valid_list); - /* Update valid check and nominated check for the component */ update_comp_check(ice, new_check->lcand->comp_id, new_check); + /* Sort valid_list (must do so after update_comp_check(), otherwise + * new_check will point to something else (#953) + */ + sort_checklist(&ice->valid_list); + /* 7.1.2.2.2. Updating Pair States * * The agent sets the state of the pair that generated the check to -- cgit v1.2.3