This commit is contained in:
Cameron Kaiser 2020-06-16 20:18:17 -07:00
parent 0c828a96e6
commit 6ad5c12dab
3 changed files with 7 additions and 14 deletions

View File

@ -407,8 +407,7 @@ static int nr_ice_candidate_copy_for_triggered_check(nr_ice_cand_pair *pair)
copy->nominated = pair->nominated; copy->nominated = pair->nominated;
r_log(LOG_ICE,LOG_INFO,"CAND-PAIR(%s): Adding pair to check list and trigger check queue: %s",pair->codeword,pair->as_string); r_log(LOG_ICE,LOG_INFO,"CAND-PAIR(%s): Adding pair to check list and trigger check queue: %s",pair->codeword,pair->as_string);
if(r=nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,copy)) nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,copy);
ABORT(r);
nr_ice_candidate_pair_trigger_check_append(&pair->remote->stream->trigger_check_queue,copy); nr_ice_candidate_pair_trigger_check_append(&pair->remote->stream->trigger_check_queue,copy);
copy->triggered = 1; copy->triggered = 1;
@ -590,7 +589,7 @@ int nr_ice_candidate_pair_trigger_check_append(nr_ice_cand_pair_head *head,nr_ic
return(0); return(0);
} }
int nr_ice_candidate_pair_insert(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair) void nr_ice_candidate_pair_insert(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair)
{ {
nr_ice_cand_pair *c1; nr_ice_cand_pair *c1;
@ -604,8 +603,6 @@ int nr_ice_candidate_pair_insert(nr_ice_cand_pair_head *head,nr_ice_cand_pair *p
c1=TAILQ_NEXT(c1,check_queue_entry); c1=TAILQ_NEXT(c1,check_queue_entry);
} }
if(!c1) TAILQ_INSERT_TAIL(head,pair,check_queue_entry); if(!c1) TAILQ_INSERT_TAIL(head,pair,check_queue_entry);
return(0);
} }
void nr_ice_candidate_pair_restart_stun_nominated_cb(NR_SOCKET s, int how, void *cb_arg) void nr_ice_candidate_pair_restart_stun_nominated_cb(NR_SOCKET s, int how, void *cb_arg)

View File

@ -82,7 +82,7 @@ int nr_ice_candidate_pair_dump_state(nr_ice_cand_pair *pair, FILE *out);
int nr_ice_candidate_pair_cancel(nr_ice_peer_ctx *pctx,nr_ice_cand_pair *pair, int move_to_wait_state); int nr_ice_candidate_pair_cancel(nr_ice_peer_ctx *pctx,nr_ice_cand_pair *pair, int move_to_wait_state);
int nr_ice_candidate_pair_select(nr_ice_cand_pair *pair); int nr_ice_candidate_pair_select(nr_ice_cand_pair *pair);
int nr_ice_candidate_pair_do_triggered_check(nr_ice_peer_ctx *pctx, nr_ice_cand_pair *pair); int nr_ice_candidate_pair_do_triggered_check(nr_ice_peer_ctx *pctx, nr_ice_cand_pair *pair);
int nr_ice_candidate_pair_insert(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair); void nr_ice_candidate_pair_insert(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair);
int nr_ice_candidate_pair_trigger_check_append(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair); int nr_ice_candidate_pair_trigger_check_append(nr_ice_cand_pair_head *head,nr_ice_cand_pair *pair);
void nr_ice_candidate_pair_restart_stun_nominated_cb(NR_SOCKET s, int how, void *cb_arg); void nr_ice_candidate_pair_restart_stun_nominated_cb(NR_SOCKET s, int how, void *cb_arg);
int nr_ice_candidate_pair_destroy(nr_ice_cand_pair **pairp); int nr_ice_candidate_pair_destroy(nr_ice_cand_pair **pairp);

View File

@ -1333,8 +1333,7 @@ int nr_ice_component_finalize(nr_ice_component *lcomp, nr_ice_component *rcomp)
int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair) int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair)
{ {
int r,_status; int _status;
int pair_inserted=0;
/* Pairs for peer reflexive are marked SUCCEEDED immediately */ /* Pairs for peer reflexive are marked SUCCEEDED immediately */
if (pair->state != NR_ICE_PAIR_STATE_FROZEN && if (pair->state != NR_ICE_PAIR_STATE_FROZEN &&
@ -1343,10 +1342,8 @@ int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair
ABORT(R_BAD_ARGS); ABORT(R_BAD_ARGS);
} }
if(r=nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,pair)) /* We do not throw an error after this, because we've inserted the pair. */
ABORT(r); nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,pair);
pair_inserted=1;
/* Make sure the check timer is running, if the stream was previously /* Make sure the check timer is running, if the stream was previously
* started. We will not start streams just because a pair was created, * started. We will not start streams just because a pair was created,
@ -1358,13 +1355,12 @@ int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair
!pair->remote->stream->pctx->checks_started)){ !pair->remote->stream->pctx->checks_started)){
if(nr_ice_media_stream_start_checks(pair->remote->stream->pctx, pair->remote->stream)) { if(nr_ice_media_stream_start_checks(pair->remote->stream->pctx, pair->remote->stream)) {
r_log(LOG_ICE,LOG_WARNING,"ICE-PEER(%s)/CAND-PAIR(%s): Could not restart checks for new pair %s.",pair->remote->stream->pctx->label, pair->codeword, pair->as_string); r_log(LOG_ICE,LOG_WARNING,"ICE-PEER(%s)/CAND-PAIR(%s): Could not restart checks for new pair %s.",pair->remote->stream->pctx->label, pair->codeword, pair->as_string);
ABORT(R_INTERNAL);
} }
} }
_status=0; _status=0;
abort: abort:
if (_status && !pair_inserted) { if (_status) {
nr_ice_candidate_pair_destroy(&pair); nr_ice_candidate_pair_destroy(&pair);
} }
return(_status); return(_status);