int nr_ice_candidate_pair_start(nr_ice_peer_ctx *pctx, nr_ice_cand_pair *pair) { int r,_status; UINT4 mode; /* Register the stun ctx for when responses come in*/ if(r=nr_ice_socket_register_stun_client(pair->local->isock,pair->stun_client,&pair->stun_client_handle)) ABORT(r); nr_ice_candidate_pair_restart(pctx, pair); _status=0; abort: return(_status); }
int nr_ice_candidate_pair_start(nr_ice_peer_ctx *pctx, nr_ice_cand_pair *pair) { int r,_status; UINT4 mode; nr_ice_candidate_pair_set_state(pctx,pair,NR_ICE_PAIR_STATE_IN_PROGRESS); /* Register the stun ctx for when responses come in*/ if(r=nr_ice_socket_register_stun_client(pair->local->isock,pair->stun_client,&pair->stun_client_handle)) ABORT(r); /* Start STUN */ if(pair->pctx->controlling && (pair->pctx->ctx->flags & NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION)) mode=NR_ICE_CLIENT_MODE_USE_CANDIDATE; else mode=NR_ICE_CLIENT_MODE_BINDING_REQUEST; if(r=nr_stun_client_start(pair->stun_client,mode,nr_ice_candidate_pair_stun_cb,pair)) ABORT(r); if ((r=nr_ice_ctx_remember_id(pair->pctx->ctx, pair->stun_client->request))) { /* ignore if this fails (which it shouldn't) because it's only an * optimization and the cleanup routines are not going to do the right * thing if this fails */ assert(0); } _status=0; abort: if(_status){ /* Don't fire the CB, but schedule it to fire ASAP */ assert(!pair->stun_cb_timer); NR_ASYNC_TIMER_SET(0,nr_ice_candidate_pair_stun_cb,pair, &pair->stun_cb_timer); _status=0; } return(_status); }