PJ_DEF(pj_status_t) pjsip_transport_destroy( pjsip_transport *tp)
{
    pjsip_tp_state_callback state_cb;

    /* Must have no user. */
    PJ_ASSERT_RETURN(pj_atomic_get(tp->ref_cnt) == 0, PJSIP_EBUSY);

    /* Notify application of transport destroy */
    state_cb = pjsip_tpmgr_get_state_cb(tp->tpmgr);
    if (state_cb) {
	pjsip_transport_state_info state_info;

	pj_bzero(&state_info, sizeof(state_info));
        (*state_cb)(tp, PJSIP_TP_STATE_DESTROY, &state_info);
    }

    /* Destroy. */
    return destroy_transport(tp->tpmgr, tp);
}
PJ_DEF(pj_status_t) pjsip_transport_destroy( pjsip_transport *tp)
{
    pjsip_tp_state_callback state_cb;

     
    PJ_ASSERT_RETURN(pj_atomic_get(tp->ref_cnt) == 0, PJSIP_EBUSY);

     
    state_cb = pjsip_tpmgr_get_state_cb(tp->tpmgr);
    if (state_cb) {
	pjsip_transport_state_info state_info;

	pj_bzero(&state_info, sizeof(state_info));
        (*state_cb)(tp, PJSIP_TP_STATE_DESTROY, &state_info);
    }

     
    return destroy_transport(tp->tpmgr, tp);
}