aboutsummaryrefslogtreecommitdiff
path: root/lib/select.c
AgeCommit message (Collapse)Author
2011-07-25time.h and sys/time.h inclusion conditionally done in setup_once.hYang Tse
2011-06-11long/int messDaniel Stenberg
Typecast when converting to int from long to avoid some compiler warnings
2011-06-05wait_ms: takes an int argumentDaniel Stenberg
Typecasts added since I changed more code to use long for timeouts
2011-06-04Curl_socket_ready: make timeout a 'long'Daniel Stenberg
It was mostly typecasted to int all over the code so switching to long instead all over should be a net gain.
2011-05-24compiler warning: fixYang Tse
Fix compiler warning: variable was set but never used Fix compiler warning: clobber ignored
2011-04-27source cleanup: unify look, style and indent levelsDaniel Stenberg
By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed.
2010-03-24remove the CVSish $Id$ linesDaniel Stenberg
2009-10-27Fix spellingYang Tse
2009-09-15Some systems poll function sets POLLHUP in revents without settingYang Tse
POLLIN, and sets POLLERR without setting POLLIN and POLLOUT. In some libcurl code execution paths this could trigger busy wait loops with high CPU usage until a timeout condition aborted the loop. This fix for Curl_poll adresses the above in a libcurl-wide mode.
2008-05-26Andreas Faerber and Scott McCreary made (lib)curl build for the Haiku OSDaniel Stenberg
2008-05-09Internal time differences now use monotonic time source if available.Yang Tse
This also implies the removal of the winmm.lib dependency for WIN32.
2008-03-06Regression fix:Yang Tse
select/poll calls will only be retried upon EINTR failures as it previously was in lib/select.c revision 1.29 In this way Curl_socket_ready() and Curl_poll() will again fail on any select/poll errors different than EINTR.
2007-11-05removed space after if and while before the parenthesis for better source codeDaniel Stenberg
consistency
2007-10-03Cleanup no longer used macrosYang Tse
2007-10-03Fix compiler warning: local variable may be used without having been initializedYang Tse
2007-05-31When transferring 500 downloads in parallel with a c-ares enabled build onlyDaniel Stenberg
to find that it crashed miserably, and this was due to some select()isms left in the code. This was due to API restrictions in c-ares 1.3.x, but with the upcoming c-ares 1.4.0 this is no longer the case so now libcurl runs much better with c-ares and the multi interface with > 1024 file descriptors in use.
2007-05-26Primarily this fixes an off-by-one buffer overwrite (rare but still existing).Daniel Stenberg
I also switched from calloc() to malloc() as a minor performance boost since the rest of the code fills in the structs fine anyway - and they must for the case when we use the stack-based auto variable array instead of the allocated one. I made the loop filling in poll_fds[] break when poll_nfds is reached as a minor speed improvement.
2007-04-20initialize pending_ms to zero to avoid compiler warning:Yang Tse
'pending_ms' may be used uninitialized in this function
2007-04-20- Save one call to curlx_tvnow(), which calls gettimeofday(), in each ofYang Tse
Curl_socket_ready(), Curl_poll() and Curl_select() when these are called with a zero timeout or a timeout value indicating a blocking call should be performed. These unnecessary calls to gettimeofday() got introduced in 7.16.2 when fixing 'timeout would restart when signal caught while awaiting socket events' on 20 March 2007. - Move some loop breaking logic from the while clause into the loop, avoiding compiler warning 'assignment within conditional expression'
2007-04-19keep lines < 80 columnsDaniel Stenberg
2007-04-16- Robert Iakobashvil added curl_multi_socket_action() to libcurl, which is aDaniel Stenberg
function that deprecates the curl_multi_socket() function. Using the new function the application tell libcurl what action that was found in the socket that it passes in. This gives a significant performance boost as it allows libcurl to avoid a call to poll()/select() for every call to curl_multi_socket*().
2007-04-04move WinSock definitions of EBADF, EINTR, EINVAL and EAFNOSUPPORT to ↵Yang Tse
setup_once.h
2007-04-03fix MSDOS symbol checkYang Tse
2007-04-02fix compiler warningYang Tse
2007-03-29fix error introduced in last commitYang Tse
2007-03-28Improve detection of socket events which allow a further recv() callYang Tse
to complete with no delay and actually find out what happened with the socket. As well as detection of socket send()able condition. This also allows removal of a Cygwin specific block of code.
2007-03-27New Internal wrapper function Curl_select() around select (2), itYang Tse
uses poll() when a fine poll() is available, so now libcurl can be built without select() support at all if a fine poll() is available.
2007-03-27don't retry select() call upon unrecoverable error EBADFYang Tse
2007-03-26Internal function Curl_select() renamed to Curl_socket_ready()Yang Tse
2007-03-22Add a couple of local macros to improve code readability.Yang Tse
For completeness sake, wait_ms() might also get interrupted when experimental CURL_ACKNOWLEDGE_EINTR is defined.
2007-03-21fix compiler warning: implicit conversion from "long" to "int"Yang Tse
2007-03-20Fixed: When a signal was caught awaiting for an event using Curl_select()Yang Tse
or Curl_poll() with a non-zero timeout both functions would restart the specified timeout. This could even lead to the extreme case that if a signal arrived with a frecuency lower to the specified timeout neither function would ever exit. Added experimental symbol definition check CURL_ACKNOWLEDGE_EINTR in Curl_select() and Curl_poll(). When compiled with CURL_ACKNOWLEDGE_EINTR defined both functions will return as soon as a signal is caught. Use it at your own risk, all calls to these functions in the library should be revisited and checked before fully supporting this feature.
2007-03-18Fix compiler warning/error: ISO C90 forbids mixed declarations and codeYang Tse
2007-03-18Code refactoring, extracting a new function wait_ms() from Curl_select andYang Tse
Curl_poll() which is called whenever not a single valid file descriptor is passed to these functions. Improve readibility using a poll() macro to replace WSApoll().
2007-03-11reverted the pselect patch => http://curl.haxx.se/mail/lib-2007-03/0100.htmlDaniel Stenberg
2007-03-10- Bryan Henderson introduces two things:Daniel Stenberg
1) the progress callback gets called more frequently (at times) 2) libcurl *might* call the callback when it receives a signal
2007-02-26Removed inclusion of <sys/types.h> and <sys/stat.h> in .c-filesGisle Vanem
since they're already included through "setup.h".
2007-02-16use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handlingYang Tse
2007-01-05Include <dos.h> for delay() on MSDOS.Gisle Vanem
2007-01-02- Victor Snezhko helped us fix bug report #1603712Daniel Stenberg
(http://curl.haxx.se/bug/view.cgi?id=1603712) (known bug #36) --limit-rate (CURLOPT_MAX_SEND_SPEED_LARGE and CURLOPT_MAX_RECV_SPEED_LARGE) are broken on Windows (since 7.16.0, but that's when they were introduced as previous to that the limiting logic was made in the application only and not in the library). It was actually also broken on select()-based systems (as apposed to poll()) but we haven't had any such reports. We now use select(), Sleep() or delay() properly to sleep a while without waiting for anything input or output when the rate limiting is activated with the easy interface.
2006-12-05Matt Witherspoon fixed a problem case when the CPU load went to 100% when aDaniel Stenberg
HTTP upload was disconnected: "What appears to be happening is that my system (Linux 2.6.17 and 2.6.13) is setting *only* POLLHUP on poll() when the conditions in my previous mail occur. As you can see, select.c:Curl_select() does not check for POLLHUP. So basically what was happening, is poll() was returning immediately (with POLLHUP set), but when Curl_select() looked at the bits, neither POLLERR or POLLOUT was set. This still caused Curl_readwrite() to be called, which quickly returned. Then the transfer() loop kept continuing at full speed forever."
2006-10-18Check for USE_WINSOCK instead of WIN32 where the check was doneYang Tse
to verify winsock API availability.
2006-10-09Cygwin 1.5.21 needs this hack to pass test 160.Yang Tse
In this way 304 tests out of 304 reported OK.
2006-09-24Cory Nelson made libcurl use the WSAPoll() function if built for WindowsDaniel Stenberg
Vista (_WIN32_WINNT >= 0x0600)
2006-05-05additional renames of Curl_ourerrno => Curl_sockerrnoDaniel Stenberg
2006-04-26Fixed signed/unsigned convertion errors in Salford-C.Gisle Vanem
#ifdef around WSAEDISCON in strerror.c.
2006-04-07First commit of David McCreedy's EBCDIC and TPF changes.Daniel Stenberg
2005-11-13Thanks to this nice summary of poll() implementations:Daniel Stenberg
http://www.greenend.org.uk/rjk/2001/06/poll.html and further tests by Eugene Kotlyarov, we now know that cygwin's poll returns only POLLHUP on remote connection closure so we check for that case (too) and re-enable poll for cygwin builds.
2005-04-26Cory Nelson's work on nuking compiler warnings when building on x64 withDaniel Stenberg
VS2005.
2005-03-31Updated the copyright year since changes have been this year.Daniel Stenberg