Ignore:
Timestamp:
Sep 29, 2017 2:43:05 AM (7 years ago)
Author:
ming
Message:

Fix #2048: Add compile time option to disable sleep in sip endpoint's handle events on ioqueue polling's error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c

    r5397 r5668  
    3535#include <pj/errno.h> 
    3636#include <pj/lock.h> 
     37#include <pj/math.h> 
    3738 
    3839#define PJSIP_EX_NO_MEMORY  pj_NO_MEMORY_EXCEPTION() 
     
    700701                                               unsigned *p_count) 
    701702{ 
     703    enum { MAX_TIMEOUT_ON_ERR = 10 }; 
    702704    /* timeout is 'out' var. This just to make compiler happy. */ 
    703705    pj_time_val timeout = { 0, 0}; 
     
    743745        if (c < 0) { 
    744746            pj_status_t err = pj_get_netos_error(); 
    745             pj_thread_sleep(PJ_TIME_VAL_MSEC(timeout)); 
     747#if PJSIP_HANDLE_EVENTS_HAS_SLEEP_ON_ERR 
     748            unsigned msec = PJ_TIME_VAL_MSEC(timeout); 
     749            pj_thread_sleep(PJ_MIN(msec, MAX_TIMEOUT_ON_ERR)); 
     750#endif 
     751 
    746752            if (p_count) 
    747753                *p_count = count; 
Note: See TracChangeset for help on using the changeset viewer.