1. 程式人生 > >ICE中地址對重發探測機制

ICE中地址對重發探測機制

 if (c->state == PJ_ICE_SESS_CHECK_STATE_WAITING)
 {


     /* See if we shall nominate this check */
     pj_bool_t nominate = (c->nominated || ice->is_nominating); 

     LOG5((ice->obj_name, "Performing triggered check for check %d",i));
     pj_log_push_indent();
     perform_check(ice, &ice->clist, i, nominate);
     pj_log_pop_indent();

 } else if (c->state == PJ_ICE_SESS_CHECK_STATE_IN_PROGRESS) {
     /* Should retransmit immediately
      */
     LOG5((ice->obj_name, "Triggered check for check %d not performed "
    "because it's in progress. Retransmitting", i));
     pj_log_push_indent();
     pj_stun_session_retransmit_req(comp->stun_sess, c->tdata, PJ_FALSE);
     pj_log_pop_indent();

上面程式能夠走到這一步,說明雙方都應該是處在non_symmertric_NAT之下!

一端A之前發包到另一端B,由於之前另一端B並沒有打孔。所以一端A的請求並不能夠進入另一端B。但是A的這個發包其實給B後來的發包打了孔!!!

當B向A發包的時候,由於有了孔,因此包可以進行穿越。當A收到B的包時,因為在之前B進行發包被丟棄,但是這個地址對的狀態執行perform_check之後變成了IN_PROGRESS狀態。因此根據上述的條件會進行立即重發處理!此時也就會形成一個valid_pair!