Changeset 195


Ignore:
Timestamp:
Feb 19, 2006 1:34:57 AM (18 years ago)
Author:
bennylp
Message:

Return correct error when sending message failed

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_transaction.h

    r160 r195  
    9999    pjsip_response_addr         res_addr;       /**< Response address.      */ 
    100100    unsigned                    transport_flag; /**< Miscelaneous flag.     */ 
     101    pj_status_t                 transport_err;  /**< Internal error code.   */ 
    101102 
    102103    /* 
     
    281282 
    282283/* 
     284 * Dump transaction layer. 
     285 */ 
     286PJ_DECL(void) pjsip_tsx_layer_dump(void); 
     287 
     288/* 
    283289 * Get the string name for the state. 
    284290 */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r175 r195  
    419419    PJ_ASSERT_RETURN(mod_tsx_layer.endpt==NULL, PJ_EINVALIDOP); 
    420420 
    421     PJ_LOG(5,(THIS_FILE, "Initializing transaction layer module")); 
    422  
    423421    /* Initialize TLS ID for transaction lock. */ 
    424422    status = pj_thread_local_alloc(&pjsip_tsx_lock_tls_id); 
     
    468466        return status; 
    469467    } 
    470  
    471     PJ_LOG(4,(THIS_FILE, "Transaction layer module initialized")); 
    472468 
    473469    return PJ_SUCCESS; 
     
    763759} 
    764760 
     761 
     762/* 
     763 * Dump transaction layer. 
     764 */ 
     765PJ_DEF(void) pjsip_tsx_layer_dump(void) 
     766{ 
     767#if PJ_LOG_MAX_LEVEL >= 3 
     768    pj_hash_iterator_t itbuf, *it; 
     769 
     770    /* Lock mutex. */ 
     771    pj_mutex_lock(mod_tsx_layer.mutex); 
     772 
     773    PJ_LOG(3, (THIS_FILE, "Dumping transaction table:")); 
     774 
     775    it = pj_hash_first(mod_tsx_layer.htable, &itbuf); 
     776    if (it == NULL) { 
     777        PJ_LOG(3, (THIS_FILE, " - none - ")); 
     778    } else { 
     779        while (it != NULL) { 
     780            pjsip_transaction *tsx = pj_hash_this( mod_tsx_layer.htable, it); 
     781 
     782            PJ_LOG(3, (THIS_FILE, " %s %s|%d|%s", 
     783                       tsx->obj_name, 
     784                       (tsx->last_tx? pjsip_tx_data_get_info(tsx->last_tx): "none"), 
     785                       tsx->status_code, 
     786                       pjsip_tsx_state_str(tsx->state))); 
     787 
     788            it = pj_hash_next(mod_tsx_layer.htable, it); 
     789        } 
     790    } 
     791 
     792    /* Unlock mutex. */ 
     793    pj_mutex_unlock(mod_tsx_layer.mutex); 
     794#endif 
     795} 
    765796 
    766797/***************************************************************************** 
     
    14471478            char errmsg[PJ_ERR_MSG_SIZE]; 
    14481479 
     1480            tsx->transport_err = -sent; 
     1481 
    14491482            PJ_LOG(4,(tsx->obj_name,  
    14501483                      "Failed to send %s! err=%d (%s)", 
     
    14901523        struct tsx_lock_data lck; 
    14911524        char errmsg[PJ_ERR_MSG_SIZE]; 
     1525 
     1526        tsx->transport_err = -sent; 
    14921527 
    14931528        PJ_LOG(4,(tsx->obj_name, "Transport failed to send %s! Err=%d (%s)", 
     
    16121647        /* Check if transaction is terminated. */ 
    16131648        if (status==PJ_SUCCESS && tsx->state == PJSIP_TSX_STATE_TERMINATED) 
    1614             status = PJSIP_ETSXDESTROYED; 
     1649            status = tsx->transport_err; 
    16151650 
    16161651    } else { 
     
    16271662        /* Check if transaction is terminated. */ 
    16281663        if (status==PJ_SUCCESS && tsx->state == PJSIP_TSX_STATE_TERMINATED) 
    1629             status = PJSIP_ETSXDESTROYED; 
     1664            status = tsx->transport_err; 
    16301665 
    16311666    } 
Note: See TracChangeset for help on using the changeset viewer.