Ignore:
Timestamp:
Jan 21, 2010 10:04:26 AM (14 years ago)
Author:
bennylp
Message:

Ticket #1029: Fix support for multiple (event) subscriptions in a single dialog (thanks Wang Eric for the report)

File:
1 edited

Legend:

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

    r2822 r3068  
    736736 
    737737 
    738     /* Create subcription list: */ 
    739  
    740     dlgsub_head = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub); 
    741     dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub); 
    742     dlgsub->sub = sub; 
    743  
    744     pj_list_init(dlgsub_head); 
    745     pj_list_push_back(dlgsub_head, dlgsub); 
    746  
    747  
    748     /* Register as dialog usage: */ 
    749  
    750     status = pjsip_dlg_add_usage(dlg, &mod_evsub.mod, dlgsub_head); 
    751     if (status != PJ_SUCCESS) { 
    752         pjsip_dlg_dec_lock(dlg); 
    753         return status; 
    754     } 
    755  
     738    /* Check if another subscription has been registered to the dialog. In 
     739     * that case, just add ourselves to the subscription list, otherwise 
     740     * create and register a new subscription list. 
     741     */ 
     742    if (pjsip_dlg_has_usage(dlg, &mod_evsub.mod)) { 
     743        dlgsub_head = (struct dlgsub*) dlg->mod_data[mod_evsub.mod.id]; 
     744        dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub); 
     745        dlgsub->sub = sub; 
     746        pj_list_push_back(dlgsub_head, dlgsub); 
     747    } else { 
     748        dlgsub_head = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub); 
     749        dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub); 
     750        dlgsub->sub = sub; 
     751 
     752        pj_list_init(dlgsub_head); 
     753        pj_list_push_back(dlgsub_head, dlgsub); 
     754 
     755 
     756        /* Register as dialog usage: */ 
     757 
     758        status = pjsip_dlg_add_usage(dlg, &mod_evsub.mod, dlgsub_head); 
     759        if (status != PJ_SUCCESS) { 
     760            pjsip_dlg_dec_lock(dlg); 
     761            return status; 
     762        } 
     763    } 
    756764 
    757765    PJ_LOG(5,(sub->obj_name, "%s subscription created, using dialog %s", 
Note: See TracChangeset for help on using the changeset viewer.