Ignore:
Timestamp:
Feb 28, 2014 5:42:24 AM (8 years ago)
Author:
ming
Message:

Fixed #1699: Transport state callback to report transport shutdown events (Thanks to Johan Lantz for the discussion and preliminary patch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport.c

    r4713 r4773  
    10921092    pjsip_tpmgr *mgr; 
    10931093    pj_status_t status; 
     1094    pjsip_tp_state_callback state_cb; 
    10941095 
    10951096    TRACE_((THIS_FILE, "Transport %s shutting down", tp->obj_name)); 
     
    11121113    if (tp->do_shutdown) 
    11131114        status = tp->do_shutdown(tp); 
    1114      
     1115 
     1116    /* Notify application of transport shutdown */ 
     1117    state_cb = pjsip_tpmgr_get_state_cb(tp->tpmgr); 
     1118    if (state_cb) { 
     1119        pjsip_transport_state_info state_info; 
     1120 
     1121        pj_bzero(&state_info, sizeof(state_info)); 
     1122        state_info.status = status; 
     1123        (*state_cb)(tp, PJSIP_TP_STATE_SHUTDOWN, &state_info); 
     1124    } 
     1125 
    11151126    if (status == PJ_SUCCESS) 
    11161127        tp->is_shutdown = PJ_TRUE; 
     
    11341145PJ_DEF(pj_status_t) pjsip_transport_destroy( pjsip_transport *tp) 
    11351146{ 
     1147    pjsip_tp_state_callback state_cb; 
     1148 
    11361149    /* Must have no user. */ 
    11371150    PJ_ASSERT_RETURN(pj_atomic_get(tp->ref_cnt) == 0, PJSIP_EBUSY); 
     1151 
     1152    /* Notify application of transport destroy */ 
     1153    state_cb = pjsip_tpmgr_get_state_cb(tp->tpmgr); 
     1154    if (state_cb) { 
     1155        pjsip_transport_state_info state_info; 
     1156 
     1157        pj_bzero(&state_info, sizeof(state_info)); 
     1158        (*state_cb)(tp, PJSIP_TP_STATE_DESTROY, &state_info); 
     1159    } 
    11381160 
    11391161    /* Destroy. */ 
Note: See TracChangeset for help on using the changeset viewer.