diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-04-05 23:18:14 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-04-05 23:18:14 +0000 |
commit | beddeea87ffeabce44354b7016578f577d7887dc (patch) | |
tree | 63889323487590188c8ac5e9da7228982438b794 | |
parent | 99c93933b608b111c644e3a90d484cc2dbff4b31 (diff) |
Handle scenario where ICE check list completes early in the answerer
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1157 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjnath/src/pjnath/ice_session.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index 0bfbe5f6..6cdea360 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -1126,7 +1126,39 @@ static pj_bool_t on_check_complete(pj_ice_sess *ice, } if (i == ice->clist.count) { - /* All checks have completed */ + /* All checks have completed, but we don't have nominated pair. + * If agent's role is controlled, check if all components have + * valid pair. If it does, this means the controlled agent has + * finished the check list early and it's waiting for controlling + * agent to send a check with USE-CANDIDATE flag set. + */ + if (ice->role == PJ_ICE_SESS_ROLE_CONTROLLED) { + unsigned comp_id; + for (comp_id=1; comp_id <= ice->comp_cnt; ++comp_id) { + unsigned j; + for (j=0; j<ice->valid_list.count; ++j) { + pj_ice_sess_check *vc = &ice->valid_list.checks[j]; + if (vc->lcand->comp_id == comp_id) + break; + } + if (j == ice->valid_list.count) + break; + } + + if (comp_id <= ice->comp_cnt) { + /* This component ID doesn't have valid pair. + * Mark ICE as failed. + */ + on_ice_complete(ice, PJNATH_EICEFAILED); + return PJ_TRUE; + } else { + /* All components have a valid pair. + * We should wait until we receive nominated checks. + */ + return PJ_FALSE; + } + } + on_ice_complete(ice, PJNATH_EICEFAILED); return PJ_TRUE; } |