Changeset 3022
- Timestamp:
- Nov 23, 2009 3:02:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_session.c
r3005 r3022 950 950 951 951 /* Sort checklist based on priority */ 952 static void sort_checklist(pj_ice_sess _checklist *clist)952 static void sort_checklist(pj_ice_sess *ice, pj_ice_sess_checklist *clist) 953 953 { 954 954 unsigned i; 955 pj_ice_sess_check **check_ptr[PJ_ICE_MAX_COMP*2]; 956 unsigned check_ptr_cnt = 0; 957 958 for (i=0; i<ice->comp_cnt; ++i) { 959 if (ice->comp[i].valid_check) { 960 check_ptr[check_ptr_cnt++] = &ice->comp[i].valid_check; 961 } 962 if (ice->comp[i].nominated_check) { 963 check_ptr[check_ptr_cnt++] = &ice->comp[i].nominated_check; 964 } 965 } 955 966 956 967 for (i=0; i<clist->count-1; ++i) { 957 968 unsigned j, highest = i; 969 958 970 for (j=i+1; j<clist->count; ++j) { 959 971 if (CMP_CHECK_PRIO(&clist->checks[j], &clist->checks[highest]) > 0) { … … 964 976 if (highest != i) { 965 977 pj_ice_sess_check tmp; 978 unsigned k; 966 979 967 980 pj_memcpy(&tmp, &clist->checks[i], sizeof(pj_ice_sess_check)); … … 970 983 pj_memcpy(&clist->checks[highest], &tmp, 971 984 sizeof(pj_ice_sess_check)); 985 986 /* Update valid and nominated check pointers, since we're moving 987 * around checks 988 */ 989 for (k=0; k<check_ptr_cnt; ++k) { 990 if (*check_ptr[k] == &clist->checks[highest]) 991 *check_ptr[k] = &clist->checks[i]; 992 else if (*check_ptr[k] == &clist->checks[i]) 993 *check_ptr[k] = &clist->checks[highest]; 994 } 972 995 } 973 996 } … … 1667 1690 1668 1691 /* Sort checklist based on priority */ 1669 sort_checklist( clist);1692 sort_checklist(ice, clist); 1670 1693 1671 1694 /* Prune the checklist */ … … 2335 2358 * new_check will point to something else (#953) 2336 2359 */ 2337 sort_checklist( &ice->valid_list);2360 sort_checklist(ice, &ice->valid_list); 2338 2361 2339 2362 /* 7.1.2.2.2. Updating Pair States
Note: See TracChangeset
for help on using the changeset viewer.