Changeset 275 for pjproject/trunk
- Timestamp:
- Mar 3, 2006 10:23:35 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-simple/evsub.c
r268 r275 212 212 pj_timer_entry timer; /**< Internal timer. */ 213 213 int pending_tsx; /**< Number of pending transactions.*/ 214 pjsip_transaction *pending_sub; /**< Pending UAC SUBSCRIBE tsx. */ 214 215 215 216 void *mod_data[PJSIP_MAX_MODULE]; /**< Module data. */ … … 1298 1299 sub->pending_tsx++; 1299 1300 1301 /* Special case for outgoing/UAC SUBSCRIBE/REFER transaction. 1302 * We can only have one pending UAC SUBSCRIBE/REFER, so if another 1303 * transaction is started while previous one still alive, terminate 1304 * the older one. 1305 * 1306 * Sample scenario: 1307 * - subscribe sent to destination that doesn't exist, transaction 1308 * is still retransmitting request, then unsubscribe is sent. 1309 */ 1310 if (tsx->role == PJSIP_ROLE_UAC && 1311 tsx->state == PJSIP_TSX_STATE_CALLING && 1312 pjsip_method_cmp(&tsx->method, &sub->method) == 0) 1313 { 1314 1315 if (sub->pending_sub && 1316 sub->pending_sub->state < PJSIP_TSX_STATE_COMPLETED) 1317 { 1318 PJ_LOG(4,(sub->obj_name, 1319 "Cancelling pending %.*s request", 1320 (int)sub->method.name.slen, sub->method.name.ptr)); 1321 1322 /* By convention, we use 490 (Request Updated) status code. 1323 * When transaction handler (below) see this status code, it 1324 * will ignore the transaction. 1325 */ 1326 pjsip_tsx_terminate(sub->pending_sub, PJSIP_SC_REQUEST_UPDATED); 1327 } 1328 1329 sub->pending_sub = tsx; 1330 1331 } else if (tsx == sub->pending_sub && 1332 tsx->state >= PJSIP_TSX_STATE_COMPLETED) 1333 { 1334 sub->pending_sub = NULL; 1335 } 1336 1300 1337 return sub; 1301 1338 } … … 1505 1542 if (sub->state == PJSIP_EVSUB_STATE_TERMINATED) { 1506 1543 /* Ignore, has been handled before */ 1544 return; 1545 } 1546 1547 /* Ignore 490 (Request Updated) status. 1548 * This happens when application sends SUBSCRIBE/REFER while 1549 * another one is still in progress. 1550 */ 1551 if (tsx->status_code == PJSIP_SC_REQUEST_UPDATED) { 1507 1552 return; 1508 1553 }
Note: See TracChangeset
for help on using the changeset viewer.