Changeset 576 for pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
- Timestamp:
- Jul 2, 2006 2:53:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r446 r576 703 703 --dlg->sess_count; 704 704 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); 706 708 unregister_and_destroy_dialog(dlg); 707 else {709 } else { 708 710 pj_mutex_unlock(dlg->mutex); 709 711 } … … 972 974 */ 973 975 if (msg->line.req.method.id != PJSIP_ACK_METHOD) { 976 int tsx_count; 977 974 978 status = pjsip_tsx_create_uac(dlg->ua, tdata, &tsx); 975 979 if (status != PJ_SUCCESS) … … 986 990 987 991 /* Increment transaction counter. */ 988 ++dlg->tsx_count;992 tsx_count = ++dlg->tsx_count; 989 993 990 994 /* Send the message. */ 991 995 status = pjsip_tsx_send_msg(tsx, tdata); 992 996 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); 994 999 goto on_error; 995 1000 } … … 1260 1265 pj_status_t status; 1261 1266 pjsip_transaction *tsx = NULL; 1267 pj_bool_t processed = PJ_FALSE; 1262 1268 unsigned i; 1263 1269 … … 1317 1323 /* Report the request to dialog usages. */ 1318 1324 for (i=0; i<dlg->usage_cnt; ++i) { 1319 pj_bool_t processed;1320 1325 1321 1326 if (!dlg->usage[i]->on_rx_request) … … 1331 1336 if (tsx) 1332 1337 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 } 1333 1355 1334 1356 on_return:
Note: See TracChangeset
for help on using the changeset viewer.