Changeset 486
- Timestamp:
- Jun 1, 2006 11:41:38 AM (18 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
r248 r486 117 117 118 118 /** 119 * Handle events with additional info about number of events that 120 * have been handled. 121 * 122 * @param endpt The endpoint. 123 * @param max_timeout Maximum time to wait for events, or NULL to wait forever 124 * until event is received. 125 * @param count Optional argument to receive the number of events that 126 * have been handled by the function. 127 * 128 * @return PJ_SUCCESS on success. 129 */ 130 PJ_DECL(pj_status_t) pjsip_endpt_handle_events2(pjsip_endpoint *endpt, 131 const pj_time_val *max_timeout, 132 unsigned *count); 133 /** 119 134 * Schedule timer to endpoint's timer heap. Application must poll the endpoint 120 135 * periodically (by calling #pjsip_endpt_handle_events) to ensure that the -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r448 r486 583 583 } 584 584 585 /* 586 * Handle events. 587 */ 588 PJ_DEF(pj_status_t) pjsip_endpt_handle_events(pjsip_endpoint *endpt, 589 const pj_time_val *max_timeout) 585 586 PJ_DEF(pj_status_t) pjsip_endpt_handle_events2(pjsip_endpoint *endpt, 587 const pj_time_val *max_timeout, 588 unsigned *p_count) 590 589 { 591 590 /* timeout is 'out' var. This just to make compiler happy. */ 592 591 pj_time_val timeout = { 0, 0}; 592 unsigned count = 0; 593 int c; 593 594 594 595 PJ_LOG(6, (THIS_FILE, "pjsip_endpt_handle_events()")); … … 598 599 */ 599 600 timeout.sec = timeout.msec = 0; 600 pj_timer_heap_poll( endpt->timer_heap, &timeout ); 601 c = pj_timer_heap_poll( endpt->timer_heap, &timeout ); 602 if (c > 0) 603 count += c; 601 604 602 605 /* timer_heap_poll should never ever returns negative value, or otherwise … … 613 616 614 617 /* Poll ioqueue. */ 615 if (pj_ioqueue_poll( endpt->ioqueue, &timeout) < 0) { 618 c = pj_ioqueue_poll( endpt->ioqueue, &timeout); 619 if (c < 0) { 616 620 pj_thread_sleep(1); 621 if (p_count) 622 *p_count = count; 617 623 return pj_get_netos_error(); 618 624 } else { 625 count += c; 626 if (p_count) 627 *p_count = count; 619 628 return PJ_SUCCESS; 620 629 } 630 } 631 632 /* 633 * Handle events. 634 */ 635 PJ_DEF(pj_status_t) pjsip_endpt_handle_events(pjsip_endpoint *endpt, 636 const pj_time_val *max_timeout) 637 { 638 return pjsip_endpt_handle_events2(endpt, max_timeout, NULL); 621 639 } 622 640
Note: See TracChangeset
for help on using the changeset viewer.