diff options
author | Byron Campen [:bwc] <docfaraday@gmail.com> | 2020-07-09 13:14:34 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-07-10 18:32:51 +0000 |
commit | 9130f129063dac30bef4c16dde56289fd889a3ae (patch) | |
tree | b1880bade2d1dfa76d88a93168666d66e806244e | |
parent | 5e2b3d1d8979c2bda01fa336a0c0548f3457a084 (diff) | |
download | UXP-9130f129063dac30bef4c16dde56289fd889a3ae.tar UXP-9130f129063dac30bef4c16dde56289fd889a3ae.tar.gz UXP-9130f129063dac30bef4c16dde56289fd889a3ae.tar.lz UXP-9130f129063dac30bef4c16dde56289fd889a3ae.tar.xz UXP-9130f129063dac30bef4c16dde56289fd889a3ae.zip |
[WebRTC] Make candidate pair insertion code easier to read/understand.
Includes removing an error code for a function that never fails, and removing an
error return when the function successfully did what it said it would.
Ref: BZ 1644477
3 files changed, 7 insertions, 14 deletions
diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c index 6c07ae2a6..f08a20a1f 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c @@ -418,8 +418,7 @@ static int nr_ice_candidate_copy_for_triggered_check(nr_ice_cand_pair *pair) 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); - if(r=nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,copy)) - ABORT(r); + nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,copy); nr_ice_candidate_pair_trigger_check_append(&pair->remote->stream->trigger_check_queue,copy); copy->triggered = 1; @@ -601,7 +600,7 @@ int nr_ice_candidate_pair_trigger_check_append(nr_ice_cand_pair_head *head,nr_ic 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; @@ -615,8 +614,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); } 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) diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h index 171ded4a0..cb3d61eca 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h @@ -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_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_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); 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); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_component.c b/media/mtransport/third_party/nICEr/src/ice/ice_component.c index 11b4fcbc1..7a42eb208 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c @@ -1613,8 +1613,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 r,_status; - int pair_inserted=0; + int _status; /* Pairs for peer reflexive are marked SUCCEEDED immediately */ if (pair->state != NR_ICE_PAIR_STATE_FROZEN && @@ -1623,10 +1622,8 @@ int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair ABORT(R_BAD_ARGS); } - if(r=nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,pair)) - ABORT(r); - - pair_inserted=1; + /* We do not throw an error after this, because we've inserted the pair. */ + nr_ice_candidate_pair_insert(&pair->remote->stream->check_list,pair); /* Make sure the check timer is running, if the stream was previously * started. We will not start streams just because a pair was created, @@ -1638,13 +1635,12 @@ int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair !pair->remote->stream->pctx->checks_started)){ 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); - ABORT(R_INTERNAL); } } _status=0; abort: - if (_status && !pair_inserted) { + if (_status) { nr_ice_candidate_pair_destroy(&pair); } return(_status); |