Changeset 2945 for pjproject/trunk/pjnath/src/pjnath/ice_strans.c
- Timestamp:
- Oct 14, 2009 1:13:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r2724 r2945 174 174 pj_lock_t *init_lock; /**< Initialization mutex. */ 175 175 176 pj_ice_strans_state state; /**< Session state. */ 176 177 pj_ice_sess *ice; /**< ICE session. */ 177 178 pj_time_val start_time;/**< Time when ICE was started */ … … 488 489 ice_st->comp = (pj_ice_strans_comp**) 489 490 pj_pool_calloc(pool, comp_cnt, sizeof(pj_ice_strans_comp*)); 491 492 /* Move state to candidate gathering */ 493 ice_st->state = PJ_ICE_STRANS_STATE_INIT; 490 494 491 495 /* Acquire initialization mutex to prevent callback to be … … 562 566 } 563 567 568 /* Get ICE session state. */ 569 PJ_DEF(pj_ice_strans_state) pj_ice_strans_get_state(pj_ice_strans *ice_st) 570 { 571 return ice_st->state; 572 } 573 574 /* State string */ 575 PJ_DEF(const char*) pj_ice_strans_state_name(pj_ice_strans_state state) 576 { 577 const char *names[] = { 578 "Null", 579 "Candidate Gathering", 580 "Candidate Gathering Complete", 581 "Session Initialized", 582 "Negotiation In Progress", 583 "Negotiation Success", 584 "Negotiation Failed" 585 }; 586 587 PJ_ASSERT_RETURN(state <= PJ_ICE_STRANS_STATE_FAILED, "???"); 588 return names[state]; 589 } 590 564 591 /* Notification about failure */ 565 592 static void sess_fail(pj_ice_strans *ice_st, pj_ice_strans_op op, … … 604 631 /* All candidates have been gathered */ 605 632 ice_st->cb_called = PJ_TRUE; 633 ice_st->state = PJ_ICE_STRANS_STATE_READY; 606 634 if (ice_st->cb.on_ice_complete) 607 635 (*ice_st->cb.on_ice_complete)(ice_st, PJ_ICE_STRANS_OP_INIT, … … 783 811 } 784 812 813 /* ICE session is ready for negotiation */ 814 ice_st->state = PJ_ICE_STRANS_STATE_SESS_READY; 815 785 816 return PJ_SUCCESS; 786 817 … … 983 1014 } 984 1015 1016 ice_st->state = PJ_ICE_STRANS_STATE_NEGO; 985 1017 return status; 986 1018 } … … 1012 1044 } 1013 1045 1046 ice_st->state = PJ_ICE_STRANS_STATE_INIT; 1014 1047 return PJ_SUCCESS; 1015 1048 } … … 1170 1203 } 1171 1204 1205 ice_st->state = (status==PJ_SUCCESS) ? PJ_ICE_STRANS_STATE_RUNNING : 1206 PJ_ICE_STRANS_STATE_FAILED; 1207 1172 1208 (*ice_st->cb.on_ice_complete)(ice_st, PJ_ICE_STRANS_OP_NEGOTIATION, 1173 1209 status);
Note: See TracChangeset
for help on using the changeset viewer.