add more range to saved candidates and fix off-by-one error when total is met

This commit is contained in:
Anthony Minessale 2013-11-30 19:13:49 -06:00
parent 4e6852fd88
commit ae99177598
2 changed files with 3 additions and 3 deletions

View File

@ -96,7 +96,7 @@ typedef struct icand_s {
uint8_t ready;
} icand_t;
#define MAX_CAND 25
#define MAX_CAND 50
typedef struct ice_s {
icand_t cands[MAX_CAND][2];

View File

@ -2332,6 +2332,8 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
data = switch_core_session_strdup(smh->session, attr->a_value);
argc = switch_split(data, ' ', fields);
engine->ice_in.cand_idx++;
if (argc < 5 || engine->ice_in.cand_idx >= MAX_CAND) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Invalid data\n");
@ -2349,8 +2351,6 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
"Checking Candidate cid: %d proto: %s type: %s addr: %s:%s\n", cid+1, fields[2], fields[7], fields[4], fields[5]);
engine->ice_in.cand_idx++;
for (i = 0; i < engine->cand_acl_count; i++) {
if (!engine->ice_in.chosen[cid] && switch_check_network_list_ip(fields[4], engine->cand_acl[i])) {
engine->ice_in.chosen[cid] = engine->ice_in.cand_idx;