Ignore:
Timestamp:
May 30, 2013 9:27:49 AM (11 years ago)
Author:
nanang
Message:

Fixed #1671:

  • Transport manager maintains transmit buffer instance list, so any dangling transmit buffer will be freed when transport manager is destroyed. This is configurable via PJSIP_HAS_TX_DATA_LIST, the default is zero/disabled.
  • Updated publish client subscription to not use the 'internal' pjsip_tx_data list structure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/publishc.c

    r4206 r4530  
    6262typedef struct pending_publish 
    6363{ 
    64     PJ_DECL_LIST_MEMBER(pjsip_tx_data); 
     64    PJ_DECL_LIST_MEMBER(struct pending_publish); 
     65    pjsip_tx_data               *tdata; 
    6566} pending_publish; 
    6667 
     
    109110    /* Pending PUBLISH request */ 
    110111    pending_publish              pending_reqs; 
     112    pending_publish              pending_reqs_empty; 
    111113}; 
    112114 
     
    181183    pj_memcpy(&pubc->opt, opt, sizeof(*opt)); 
    182184    pj_list_init(&pubc->pending_reqs); 
     185    pj_list_init(&pubc->pending_reqs_empty); 
    183186 
    184187    status = pj_mutex_create_recursive(pubc->pool, "pubc%p", &pubc->mutex); 
     
    684687        pj_mutex_lock(pubc->mutex); 
    685688        while (!pj_list_empty(&pubc->pending_reqs)) { 
    686             pjsip_tx_data *tdata = pubc->pending_reqs.next; 
    687             pj_list_erase(tdata); 
     689            pending_publish *pp = pubc->pending_reqs.next; 
     690            pjsip_tx_data *tdata = pp->tdata; 
     691 
     692            /* Remove the request from pending request list, 
     693             * and keep the unused entry into pending_reqs_empty pool. 
     694             */ 
     695            pj_list_erase(pp); 
     696            pj_list_push_back(&pubc->pending_reqs_empty, pp); 
    688697 
    689698            /* Add SIP-If-Match if we have etag and the request doesn't have 
     
    713722            if (status == PJ_EPENDING) { 
    714723                pj_assert(!"Not expected"); 
    715                 pj_list_erase(tdata); 
    716724                pjsip_tx_data_dec_ref(tdata); 
    717725            } else if (status == PJ_SUCCESS) { 
     
    745753    if (pubc->pending_tsx) { 
    746754        if (pubc->opt.queue_request) { 
    747             pj_list_push_back(&pubc->pending_reqs, tdata); 
     755            pending_publish *pp = NULL; 
     756            if (pj_list_empty(&pubc->pending_reqs_empty)) { 
     757                pp = PJ_POOL_ZALLOC_T(pubc->pool, pending_publish); 
     758            } else { 
     759                pp = pubc->pending_reqs_empty.next; 
     760                pj_list_erase(pp); 
     761            } 
     762            pp->tdata = tdata; 
     763            pj_list_push_back(&pubc->pending_reqs, pp); 
    748764            pj_mutex_unlock(pubc->mutex); 
    749765            PJ_LOG(4,(THIS_FILE, "Request is queued, pubc has another " 
Note: See TracChangeset for help on using the changeset viewer.