Changeset 841
- Timestamp:
- Dec 1, 2006 8:50:01 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
r799 r841 47 47 pjsip_endpoint *endpt; 48 48 pj_bool_t _delete_flag; 49 int pending_tsx; 49 pj_bool_t has_tsx; 50 pj_int32_t busy; 50 51 51 52 void *token; … … 120 121 PJ_ASSERT_RETURN(regc, PJ_EINVAL); 121 122 122 if (regc-> pending_tsx) {123 if (regc->has_tsx || regc->busy) { 123 124 regc->_delete_flag = 1; 124 125 regc->cb = NULL; … … 138 139 info->server_uri = regc->str_srv_url; 139 140 info->client_uri = regc->from_uri; 140 info->is_busy = (regc-> pending_tsx != 0);141 info->is_busy = (regc->busy || regc->has_tsx); 141 142 info->auto_reg = regc->auto_reg; 142 143 info->interval = regc->expires; 143 144 144 if (regc-> pending_tsx)145 if (regc->has_tsx) 145 146 info->next_reg = 0; 146 147 else if (regc->auto_reg == 0) … … 522 523 523 524 /* Decrement pending transaction counter. */ 524 pj_assert(regc-> pending_tsx > 0);525 --regc->pending_tsx;525 pj_assert(regc->has_tsx); 526 regc->has_tsx = PJ_FALSE; 526 527 527 528 /* If registration data has been deleted by user then remove registration … … 615 616 } 616 617 617 /* Increment pending_tsxtemporarily to prevent regc from618 /* Increment busy flag temporarily to prevent regc from 618 619 * being destroyed. 619 620 */ 620 ++regc-> pending_tsx;621 ++regc->busy; 621 622 622 623 /* Call callback. */ … … 628 629 contact_cnt, contact); 629 630 630 /* Decrement pending_tsx*/631 --regc-> pending_tsx;631 /* Decrement busy flag */ 632 --regc->busy; 632 633 } 633 634 634 635 /* Delete the record if user destroy regc during the callback. */ 635 if (regc->_delete_flag && regc-> pending_tsx==0) {636 if (regc->_delete_flag && regc->busy==0) { 636 637 pjsip_regc_destroy(regc); 637 638 } … … 645 646 646 647 /* Make sure we don't have pending transaction. */ 647 if (regc-> pending_tsx) {648 if (regc->has_tsx) { 648 649 PJ_LOG(4,(THIS_FILE, "Unable to send request, regc has another " 649 650 "transaction pending")); … … 663 664 * may be called even before send_request() returns! 664 665 */ 665 regc->pending_tsx += 2; 666 regc->has_tsx = PJ_TRUE; 667 ++regc->busy; 666 668 status = pjsip_endpt_send_request(regc->endpt, tdata, -1, regc, &tsx_callback); 667 669 if (status!=PJ_SUCCESS) { 668 670 PJ_LOG(4,(THIS_FILE, "Error sending request, status=%d", status)); 669 671 } 670 --regc-> pending_tsx;672 --regc->busy; 671 673 672 674 /* Delete the record if user destroy regc during the callback. */ 673 if (regc->_delete_flag && regc-> pending_tsx==0) {675 if (regc->_delete_flag && regc->busy==0) { 674 676 pjsip_regc_destroy(regc); 675 677 }
Note: See TracChangeset
for help on using the changeset viewer.