Ignore:
Timestamp:
Jul 2, 2006 2:53:05 PM (18 years ago)
Author:
bennylp
Message:

Final changeset from the PROTOS testing, fixed misc. crashes. See
mailing list archive for the details

File:
1 edited

Legend:

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

    r446 r576  
    703703    --dlg->sess_count; 
    704704 
    705     if (dlg->sess_count==0 && dlg->tsx_count==0) 
     705    if (dlg->sess_count==0 && dlg->tsx_count==0) { 
     706        pj_mutex_unlock(dlg->mutex); 
     707        pj_mutex_lock(dlg->mutex); 
    706708        unregister_and_destroy_dialog(dlg); 
    707     else { 
     709    } else { 
    708710        pj_mutex_unlock(dlg->mutex); 
    709711    } 
     
    972974     */ 
    973975    if (msg->line.req.method.id != PJSIP_ACK_METHOD) { 
     976        int tsx_count; 
     977 
    974978        status = pjsip_tsx_create_uac(dlg->ua, tdata, &tsx); 
    975979        if (status != PJ_SUCCESS) 
     
    986990 
    987991        /* Increment transaction counter. */ 
    988         ++dlg->tsx_count; 
     992        tsx_count = ++dlg->tsx_count; 
    989993 
    990994        /* Send the message. */ 
    991995        status = pjsip_tsx_send_msg(tsx, tdata); 
    992996        if (status != PJ_SUCCESS) { 
    993             pjsip_tsx_terminate(tsx, tsx->status_code); 
     997            if (dlg->tsx_count == tsx_count) 
     998                pjsip_tsx_terminate(tsx, tsx->status_code); 
    994999            goto on_error; 
    9951000        } 
     
    12601265    pj_status_t status; 
    12611266    pjsip_transaction *tsx = NULL; 
     1267    pj_bool_t processed = PJ_FALSE; 
    12621268    unsigned i; 
    12631269 
     
    13171323    /* Report the request to dialog usages. */ 
    13181324    for (i=0; i<dlg->usage_cnt; ++i) { 
    1319         pj_bool_t processed; 
    13201325 
    13211326        if (!dlg->usage[i]->on_rx_request) 
     
    13311336    if (tsx) 
    13321337        pjsip_tsx_recv_msg(tsx, rdata); 
     1338 
     1339    /* If no dialog usages has claimed the processing of the transaction, 
     1340     * and if transaction has not sent final response, respond with 
     1341     * 500/Internal Server Error. 
     1342     */ 
     1343    if (!processed && tsx && tsx->status_code < 200) { 
     1344        pjsip_tx_data *tdata; 
     1345        const pj_str_t reason = { "No session found", 16}; 
     1346 
     1347        PJ_LOG(4,(tsx->obj_name, "Incoming request was unhandled by " 
     1348                                 "dialog usages, sending 500 response")); 
     1349 
     1350        status = pjsip_dlg_create_response(dlg, rdata, 500, &reason, &tdata); 
     1351        if (status == PJ_SUCCESS) { 
     1352            status = pjsip_dlg_send_response(dlg, tsx, tdata); 
     1353        } 
     1354    } 
    13331355 
    13341356on_return: 
Note: See TracChangeset for help on using the changeset viewer.