Ignore:
Timestamp:
Feb 8, 2006 10:44:25 PM (18 years ago)
Author:
bennylp
Message:

Finished invite session UAS implementation

File:
1 edited

Legend:

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

    r152 r160  
    171171static int         tsx_send_msg( pjsip_transaction *tsx,  
    172172                                 pjsip_tx_data *tdata); 
    173 static void        tsx_on_rx_msg( pjsip_transaction *tsx, 
    174                                   pjsip_rx_data *rdata ); 
    175173 
    176174 
     
    698696    /* Race condition! 
    699697     * Transaction may gets deleted before we have chance to lock it 
    700      * in tsx_on_rx_msg(). 
     698     * in pjsip_tsx_recv_msg(). 
    701699     */ 
    702700    PJ_TODO(FIX_RACE_CONDITION_HERE); 
    703701 
    704702    /* Pass the message to the transaction. */ 
    705     tsx_on_rx_msg(tsx, rdata ); 
     703    pjsip_tsx_recv_msg(tsx, rdata ); 
    706704 
    707705    return PJ_TRUE; 
     
    746744    /* Race condition! 
    747745     * Transaction may gets deleted before we have chance to lock it 
    748      * in tsx_on_rx_msg(). 
     746     * in pjsip_tsx_recv_msg(). 
    749747     */ 
    750748    PJ_TODO(FIX_RACE_CONDITION_HERE); 
    751749 
    752750    /* Pass the message to the transaction. */ 
    753     tsx_on_rx_msg(tsx, rdata ); 
     751    pjsip_tsx_recv_msg(tsx, rdata ); 
    754752 
    755753    return PJ_TRUE; 
     
    966964        pj_assert(rdata != NULL); 
    967965 
    968         if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG && 
    969             tsx->tsx_user->on_rx_request) 
    970         { 
    971             (*tsx->tsx_user->on_rx_request)(rdata); 
    972  
    973         } else if (rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG && 
     966        if (rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG && 
    974967                   tsx->tsx_user->on_rx_response) 
    975968        { 
     
    12401233 
    12411234 
    1242     /* Begin with state TRYING. 
     1235    /* Begin with state NULL. 
    12431236     * Manually set-up the state becase we don't want to call the callback. 
    12441237     */ 
    1245     tsx->state = PJSIP_TSX_STATE_TRYING;  
    1246     tsx->state_handler = &tsx_on_state_trying; 
     1238    tsx->state = PJSIP_TSX_STATE_NULL;  
     1239    tsx->state_handler = &tsx_on_state_null; 
    12471240 
    12481241    /* Get response address. */ 
     
    13281321                             state_str[tsx->state])); 
    13291322 
    1330     PJSIP_EVENT_INIT_TX_MSG(event, tsx, tdata); 
     1323    PJSIP_EVENT_INIT_TX_MSG(event, tdata); 
    13311324 
    13321325    /* Dispatch to transaction. */ 
     
    13501343 * transaction is received. 
    13511344 */ 
    1352 static void tsx_on_rx_msg( pjsip_transaction *tsx, pjsip_rx_data *rdata) 
     1345PJ_DEF(void) pjsip_tsx_recv_msg( pjsip_transaction *tsx,  
     1346                                 pjsip_rx_data *rdata) 
    13531347{ 
    13541348    pjsip_event event; 
     
    13631357 
    13641358    /* Init event. */ 
    1365     PJSIP_EVENT_INIT_RX_MSG(event, tsx, rdata); 
     1359    PJSIP_EVENT_INIT_RX_MSG(event, rdata); 
    13661360 
    13671361    /* Dispatch to transaction. */ 
     
    17171711    if (tsx->role == PJSIP_ROLE_UAS) { 
    17181712 
    1719         /* UAS doesn't have STATE_NULL. 
    1720          * State has moved from NULL after transaction is initialized. 
    1721          */ 
    1722         pj_assert(!"Bug bug bug!!"); 
    1723         return PJ_EBUG; 
     1713        /* Set state to Trying. */ 
     1714        pj_assert(event->type == PJSIP_EVENT_RX_MSG && 
     1715                  event->body.rx_msg.rdata->msg_info.msg->type ==  
     1716                    PJSIP_REQUEST_MSG); 
     1717        tsx_set_state( tsx, PJSIP_TSX_STATE_TRYING, PJSIP_EVENT_RX_MSG, 
     1718                       event->body.rx_msg.rdata); 
    17241719 
    17251720    } else { 
Note: See TracChangeset for help on using the changeset viewer.