Ignore:
Timestamp:
Jan 12, 2007 6:37:35 AM (18 years ago)
Author:
bennylp
Message:

Workaround for ticket #50: added API to lock/bind transaction, dialog, and regc to a specific transport/listener

File:
1 edited

Legend:

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

    r839 r879  
    932932        tsx->transport = NULL; 
    933933    } 
     934    /* Decrement reference counter in transport selector */ 
     935    pjsip_tpselector_dec_ref(&tsx->tp_sel); 
     936 
    934937    /* Free last transmitted message. */ 
    935938    if (tsx->last_tx) { 
     
    13641367 
    13651368/* 
     1369 * Bind transaction to a specific transport/listener.  
     1370 */ 
     1371PJ_DEF(pj_status_t) pjsip_tsx_set_transport(pjsip_transaction *tsx, 
     1372                                            const pjsip_tpselector *sel) 
     1373{ 
     1374    struct tsx_lock_data lck; 
     1375 
     1376    /* Must be UAC transaction */ 
     1377    PJ_ASSERT_RETURN(tsx && sel && tsx->role == PJSIP_ROLE_UAC, PJ_EINVAL); 
     1378 
     1379    /* Start locking the transaction. */ 
     1380    lock_tsx(tsx, &lck); 
     1381 
     1382    /* Decrement reference counter of previous transport selector */ 
     1383    pjsip_tpselector_dec_ref(&tsx->tp_sel); 
     1384 
     1385    /* Copy transport selector structure .*/ 
     1386    pj_memcpy(&tsx->tp_sel, sel, sizeof(*sel)); 
     1387 
     1388    /* Increment reference counter */ 
     1389    pjsip_tpselector_add_ref(&tsx->tp_sel); 
     1390 
     1391    /* Unlock transaction. */ 
     1392    unlock_tsx(tsx, &lck); 
     1393 
     1394    return PJ_SUCCESS; 
     1395} 
     1396 
     1397 
     1398/* 
    13661399 * Set transaction status code and reason. 
    13671400 */ 
     
    14241457    /* Dispatch to transaction. */ 
    14251458    lock_tsx(tsx, &lck); 
     1459 
     1460    /* Set transport selector to tdata */ 
     1461    pjsip_tx_data_set_transport(tdata, &tsx->tp_sel); 
     1462 
     1463    /* Dispatch to state handler */ 
    14261464    status = (*tsx->state_handler)(tsx, &event); 
     1465 
    14271466    unlock_tsx(tsx, &lck); 
    14281467 
    1429     /* Will always decrement tdata reference counter 
    1430      * (consistent with other send functions. 
     1468    /* Only decrement reference counter when it returns success. 
     1469     * (This is the specification from the .PDF design document). 
    14311470     */ 
    14321471    if (status == PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.