Bug 1334682: start trickle timeout only after we have received at least on candidate. r=bwc

MozReview-Commit-ID: DZ1oytW6Jof

--HG--
extra : rebase_source : f4e4b5f795471188581f3949f0a0abc9ad22a4e7
This commit is contained in:
Nils Ohlmeier [:drno] 2017-01-27 14:34:42 -08:00
parent b50dd65754
commit a38f5b69d4

View File

@ -49,6 +49,7 @@ static char *RCSSTRING __UNUSED__="$Id: ice_peer_ctx.c,v 1.2 2008/04/28 17:59:01
static void nr_ice_peer_ctx_destroy_cb(NR_SOCKET s, int how, void *cb_arg);
static int nr_ice_peer_ctx_parse_stream_attributes_int(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream, nr_ice_media_stream *pstream, char **attrs, int attr_ct);
static int nr_ice_ctx_parse_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_stream *pstream, char *candidate);
static void nr_ice_peer_ctx_start_trickle_timer(nr_ice_peer_ctx *pctx);
int nr_ice_peer_ctx_create(nr_ice_ctx *ctx, nr_ice_handler *handler,char *label, nr_ice_peer_ctx **pctxp)
{
@ -310,6 +311,12 @@ int nr_ice_peer_ctx_parse_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_
ABORT(r);
}
/* Start the remote trickle grace timeout if it hasn't been started by
another trickled candidate or from the SDP. */
if (!pctx->trickle_grace_period_timer) {
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
/* Start checks if this stream is not checking yet or if it has checked
all the available candidates but not had a completed check for all
components.
@ -401,9 +408,6 @@ int nr_ice_peer_ctx_pair_candidates(nr_ice_peer_ctx *pctx)
* up in UNPAIRED after creating some pairs. */
pctx->state = NR_ICE_PEER_STATE_PAIRED;
/* Start grace period timer for incoming trickle candidates */
nr_ice_peer_ctx_start_trickle_timer(pctx);
stream=STAILQ_FIRST(&pctx->peer_streams);
while(stream){
if(r=nr_ice_media_stream_pair_candidates(pctx, stream->local_stream,
@ -432,6 +436,12 @@ int nr_ice_peer_ctx_pair_new_trickle_candidate(nr_ice_ctx *ctx, nr_ice_peer_ctx
if ((r = nr_ice_media_stream_pair_new_trickle_candidate(pctx, pstream, cand)))
ABORT(r);
/* Start the remote trickle grace timeout if it hasn't been started
already. */
if (!pctx->trickle_grace_period_timer) {
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
_status=0;
abort:
return _status;
@ -608,6 +618,10 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first)
r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) no checks to start",pctx->ctx->label,pctx->label);
ABORT(R_NOT_FOUND);
}
else {
/* Start grace period timer for more remote trickle candidates. */
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
_status=0;
abort: