Changeset 2095 for pjproject


Ignore:
Timestamp:
Jul 1, 2008 7:11:55 PM (16 years ago)
Author:
bennylp
Message:

Ticket #553: PUBLISH callback is not called when authentication fails (thanks Ruud Klaver for the report)

File:
1 edited

Legend:

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

    r2039 r2095  
    436436    entry->id = 0; 
    437437    status = pjsip_publishc_publish(pubc, 1, &tdata); 
    438     if (status == PJ_SUCCESS) { 
    439         status = pjsip_publishc_send(pubc, tdata); 
    440     }  
    441      
    442     // Callback should have been called. 
    443     // Calling it here will crash the system since pubc might have been 
    444     // destroyed 
    445     // 
    446     //if (status != PJ_SUCCESS) { 
    447     //  char errmsg[PJ_ERR_MSG_SIZE]; 
    448     //  pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg)); 
    449     //  call_callback(pubc, status, 400, &reason, NULL, -1); 
    450     //} 
     438    if (status != PJ_SUCCESS) { 
     439        char errmsg[PJ_ERR_MSG_SIZE]; 
     440        pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg)); 
     441        call_callback(pubc, status, 400, &reason, NULL, -1); 
     442        return; 
     443    } 
     444 
     445    status = pjsip_publishc_send(pubc, tdata); 
     446    /* No need to call callback as it should have been called */ 
    451447} 
    452448 
     
    479475                                            tsx->last_tx,   
    480476                                            &tdata); 
    481  
    482         if (status == PJ_SUCCESS) { 
    483             status = pjsip_publishc_send(pubc, tdata); 
    484         }  
    485          
    486         // Callback should have been called. 
    487         // Calling it here will crash the system since pubc might have been 
    488         // destroyed 
    489         // 
    490         //if (status != PJ_SUCCESS) { 
    491         //    call_callback(pubc, status, tsx->status_code,  
    492         //                &rdata->msg_info.msg->line.status.reason, 
    493         //                rdata, -1); 
    494         //} 
    495  
    496         return; 
     477        if (status != PJ_SUCCESS) { 
     478            call_callback(pubc, status, tsx->status_code,  
     479                          &rdata->msg_info.msg->line.status.reason, 
     480                          rdata, -1); 
     481        } else { 
     482            status = pjsip_publishc_send(pubc, tdata); 
     483        } 
    497484 
    498485    } else { 
Note: See TracChangeset for help on using the changeset viewer.