| 1 | The pjsip endpoint will invoke {{{pj_thread_sleep()}}} if {{{pj_ioqueue_poll()}}} returns error: |
| 2 | |
| 3 | {{{ |
| 4 | c = pj_ioqueue_poll( endpt->ioqueue, &timeout); |
| 5 | if (c < 0) { |
| 6 | pj_thread_sleep(PJ_TIME_VAL_MSEC(timeout)); |
| 7 | }}} |
| 8 | |
| 9 | Unfortunately, the select ioqueue may incorrectly return error when select actually returns timeout: |
| 10 | |
| 11 | {{{ |
| 12 | count = pj_sock_select(ioqueue->nfds+1, &rfdset, &wfdset, &xfdset, timeout); |
| 13 | if (count <= 0) |
| 14 | return -pj_get_netos_error(); |
| 15 | }}} |
| 16 | |
| 17 | Because of this, application may sleep for longer than what's required. |