diff options
Diffstat (limited to 'contrib/apr/poll/unix/poll.c')
-rw-r--r-- | contrib/apr/poll/unix/poll.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/contrib/apr/poll/unix/poll.c b/contrib/apr/poll/unix/poll.c index 7d15736..d7a436f 100644 --- a/contrib/apr/poll/unix/poll.c +++ b/contrib/apr/poll/unix/poll.c @@ -240,26 +240,25 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, { int ret; apr_status_t rv = APR_SUCCESS; -#ifdef WIN32 - apr_interval_time_t orig_timeout = timeout; -#endif - if (timeout > 0) { - timeout /= 1000; - } #ifdef WIN32 /* WSAPoll() requires at least one socket. */ if (pollset->nelts == 0) { *num = 0; - if (orig_timeout > 0) { - apr_sleep(orig_timeout); + if (timeout > 0) { + apr_sleep(timeout); return APR_TIMEUP; } return APR_SUCCESS; } - + if (timeout > 0) { + timeout /= 1000; + } ret = WSAPoll(pollset->p->pollset, pollset->nelts, (int)timeout); #else + if (timeout > 0) { + timeout /= 1000; + } ret = poll(pollset->p->pollset, pollset->nelts, timeout); #endif (*num) = ret; @@ -398,12 +397,23 @@ static apr_status_t impl_pollcb_poll(apr_pollcb_t *pollcb, apr_status_t rv = APR_SUCCESS; apr_uint32_t i; +#ifdef WIN32 + /* WSAPoll() requires at least one socket. */ + if (pollcb->nelts == 0) { + if (timeout > 0) { + apr_sleep(timeout); + return APR_TIMEUP; + } + return APR_SUCCESS; + } if (timeout > 0) { timeout /= 1000; } -#ifdef WIN32 ret = WSAPoll(pollcb->pollset.ps, pollcb->nelts, (int)timeout); #else + if (timeout > 0) { + timeout /= 1000; + } ret = poll(pollcb->pollset.ps, pollcb->nelts, timeout); #endif if (ret < 0) { |