sockets.c: Fix BUG#19161 - ensure milliseconds timeout is non-zero

when supplied timeout is also non-zero
This commit is contained in:
kieranm 2007-02-28 12:52:44 +00:00
parent f4f2bfe379
commit c52ac01fbc
2 changed files with 8 additions and 1 deletions

View File

@ -38,6 +38,10 @@ HISTORY
++ Bug fixes: ++ Bug fixes:
2007-02-28 Kieran Mansley
* sockets.c: Fix BUG#19161 - ensure milliseconds timeout is non-zero
when supplied timeout is also non-zero
(STABLE-1.2.0) (STABLE-1.2.0)
2006-12-05 Leon Woestenberg 2006-12-05 Leon Woestenberg

View File

@ -733,8 +733,11 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
if (timeout == 0) if (timeout == 0)
/* Wait forever */ /* Wait forever */
msectimeout = 0; msectimeout = 0;
else else {
msectimeout = ((timeout->tv_sec * 1000) + ((timeout->tv_usec + 500)/1000)); msectimeout = ((timeout->tv_sec * 1000) + ((timeout->tv_usec + 500)/1000));
if(msectimeout == 0)
msectimeout = 1;
}
i = sys_sem_wait_timeout(select_cb.sem, msectimeout); i = sys_sem_wait_timeout(select_cb.sem, msectimeout);