aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
AgeCommit message (Collapse)Author
2010-06-02lib: eliminate some dead codeKamil Dudka
2010-06-01multi_socket: handles timer inaccuracy better for timeoutsDaniel Stenberg
Igor Novoseltsev reported a problem with the multi socket API and using timeouts and timers. It boiled down to a problem with libcurl's use of GetTickCount() interally to figure out the current time, while Igor's own application code used another function call. It made his app call the socket API timeout function a bit _before_ libcurl would consider the timeout to trigger, and that could easily lead to timeouts or stalls in the app. It seems GetTickCount() in general often has no better resolution than 16ms and switching to the alternative function QueryPerformanceCounter has its share of problems: http://www.virtualdub.org/blog/pivot/entry.php?id=106 We address this problem by simply having libcurl treat timers that already has occured or will occur within 40ms subject for treatment. I'm confident that there are other implementations and operating systems with similarly in accurate timer functions so it makes sense to have applied generically and I don't believe we sacrifice much by adding a 40ms inaccuracy on these timeouts.
2010-05-16lib: Change some CRLF line endings to LFTor Arntsen
An update had added a couple of lines with DOS line endings, and some compilers will choke on that (e.g. the Tru64 compiler).
2010-05-12FTP: WILDCARDMATCH/CHUNKING/FNMATCH addedPavel Raiskup
2010-03-24remove the CVSish $Id$ linesDaniel Stenberg
2010-03-23delayed easy handle kill caused double Curl_close() callDaniel Stenberg
Hauke Duden provided an example program that made the multi interface crash. His example simply used the multi interface and did first one FTP transfer and after completion it used a second easy handle and did another FTP transfer on the same FTP server. This triggered a bug in the "delayed easy handle kill" system that curl uses: when an FTP connection is left alive it must keep an easy handle around internally - only for the purpose of having an easy handle when it later disconnects it. The code assumed that when the easy handle was removed and an internal reference was made, that version could be killed later on when a new easy handle came using the same connection. This was wrong as Hauke's example showed that the removed handle wasn't killed for real until later. This caused a double close attempt => segfault.
2010-03-15- Constantine Sapuntzakis brought a patch:Daniel Stenberg
The problem mentioned on Dec 10 2009 (http://curl.haxx.se/bug/view.cgi?id=2905220) was only partially fixed. Partially because an easy handle can be associated with many connections in the cache (e.g. if there is a redirect during the lifetime of the easy handle). The previous patch only cleaned up the first one. The new fix now removes the easy handle from all connections, not just the first one.
2010-02-04fix printf-style format stringsYang Tse
2010-02-02Fix compiler warnings: conversion from 'const int ' to 'unsigned char ', ↵Yang Tse
possible loss of data
2010-02-01We introduce a loop in lib/multi.c around all calls to multi_runsingle() andDaniel Stenberg
simply check for CURLM_CALL_MULTI_PERFORM internally. This has the added benefit that this goes in line with my long-term wishes to get rid of the CURLM_CALL_MULTI_PERFORM all together from the public API.
2010-01-28fix printf-style format stringsYang Tse
2010-01-11After the TCP connect is confirmed in CURLM_STATE_WAITCONNECT and it changesDaniel Stenberg
state, we return CURLM_CALL_MULTI_PERFORM unconditionally then so that we can act faster like in the case the protocol-specific connect doesn't block on anything and we can just persue on the next action immediately. It also then avoids a case where curl_multi_fdset() would return -1.
2010-01-09struct Curl_sh_entry's 'inuse' member was no longer used and is now removedDaniel Stenberg
2010-01-03- Julien Chaffraix eliminated a duplicated initialization in singlesocket().Kamil Dudka
2009-12-10- Constantine Sapuntzakis figured out a case which would lead to libcurlDaniel Stenberg
accessing alredy freed memory and thus crash when using HTTPS (with OpenSSL), multi interface and the CURLOPT_DEBUGFUNCTION and a certain order of cleaning things up. I fixed it. (http://curl.haxx.se/bug/view.cgi?id=2891591)
2009-11-18Make usage of calloc()'s arguments consistent with rest of code baseYang Tse
2009-08-24clarify the code by initing newurl to NULLDaniel Stenberg
2009-08-21- Andre Guibert de Bruet pointed out a missing return code check for aDaniel Stenberg
strdup() that could lead to segfault if it returned NULL. I extended his suggest patch to now have Curl_retry_request() return a regular return code and better check that.
2009-08-21- Lots of good work by Krister Johansen, mostly related to pipelining:Daniel Stenberg
Fix SIGSEGV on free'd easy_conn when pipe unexpectedly breaks Fix data corruption issue with re-connected transfers Fix use after free if we're completed but easy_conn not NULL
2009-08-03indentation fixes onlyDaniel Stenberg
2009-06-12fix compiler warningYang Tse
2009-06-10Adjusted to take in account that...Yang Tse
With the curl memory tracking feature decoupled from the debug build feature, CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows: CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug) DEBUGBUILD used for debug enabled specific code (--enable-debug)
2009-05-11Internal cleanup: KEEP_WRITE and KEEP_READ are now called KEEP_SEND andDaniel Stenberg
KEEP_RECV to better match the general terminology: receive and send is what we do from the (remote) servers. We read and write from and to the local fs.
2009-05-08- Constantine Sapuntzakis fixed bug report #2784055Daniel Stenberg
(http://curl.haxx.se/bug/view.cgi?id=2784055) identifying a problem to connect to SOCKS proxies when using the multi interface. It turned out to almost not work at all previously. We need to wait for the TCP connect to be properly verified before doing the SOCKS magic. There's still a flaw in the FTP code for this.
2009-04-21libcurl's memory.h renamed to curl_memory.hYang Tse
2009-02-20- Linus Nielsen Feltzing reported and helped me repeat and fix a problem withDaniel Stenberg
FTP with the multi interface: when a transfer fails, like when aborted by a write callback, the control connection was wrongly closed and thus not re-used properly. This change is also an attempt to cleanup the code somewhat in this area, as now the FTP code attempts to keep (better) track on pending responses necessary to get read in ftp_done().
2009-02-02minor comment fixDaniel Stenberg
2009-01-10- Emil Romanus fixed:Daniel Stenberg
When using the multi interface over HTTP and the server returns a Location header, the running easy handle will get stuck in the CURLM_STATE_PERFORM state, leaving the external event loop stuck waiting for data from the ingoing socket (when using the curl_multi_socket_action stuff). While this bug was pretty hard to find, it seems to require only a one-line fix. The break statement on line 1374 in multi.c caused the function to skip the call to multistate(). How to reproduce this bug? Well, that's another question. evhiperfifo.c in the examples directory chokes on this bug only _sometimes_, probably depending on how fast the URLs are added. One way of testing the bug out is writing to hiper.fifo from more than one source at the same time.
2008-12-20- Igor Novoseltsev fixed a bad situation for the multi_socket() API when doingDaniel Stenberg
pipelining, as libcurl could then easily get confused and A) work on the handle that was not "first in queue" on a pipeline, or even B) tell the app to REMOVE a socket while it was in use by a second handle in a pipeline. Both errors caused hanging or stalling applications.
2008-12-19- curl_multi_timeout() could return a timeout value of 0 even though nothingDaniel Stenberg
was actually ready to get done, as the internal time resolution is higher than the returned millisecond timer. Therefore it could cause applications running on fast processors to do short bursts of busy-loops. curl_multi_timeout() will now only return 0 if the timeout is actually alreay triggered.
2008-12-19- Using the libssh2 0.19 function libssh2_session_block_directions(), libcurlDaniel Stenberg
now has an improved ability to do right when the multi interface (both "regular" and multi_socket) is used for SCP and SFTP transfers. This should result in (much) less busy-loop situations and thus less CPU usage with no speed loss.
2008-12-12- More work with Igor Novoseltsev to first fix the remaining stuff forDaniel Stenberg
removing easy handles from multi handles when the easy handle is/was within a HTTP pipeline. His bug report #2351653 (http://curl.haxx.se/bug/view.cgi?id=2351653) was also related and was eventually fixed by a patch by Igor himself.
2008-12-03- Igor Novoseltsev filed bug #2351645Daniel Stenberg
(http://curl.haxx.se/bug/view.cgi?id=2351645) that identified a problem with the multi interface that occured if you removed an easy handle while in progress and the handle was used in a HTTP pipeline.
2008-10-30Use our Curl_addrinfo definition even when an addrinfo struct is available.Yang Tse
Use a wrapper function to call system's getaddrinfo().
2008-10-25add missing header inclusionsYang Tse
2008-10-19attempt to fix or allow further detection of an elusive icc SIGSEGVYang Tse
2008-10-08- Igor filed bug #2111613 (http://curl.haxx.se/bug/view.cgi?id=2111613) thatDaniel Stenberg
eventually identified a flaw in how the multi_socket interface in some cases missed to call the timeout callback when easy interfaces are removed and added within the same millisecond.
2008-09-29- Bug #2107803 (http://curl.haxx.se/bug/view.cgi?id=2107803) "noDaniel Stenberg
CURLINFO_REDIRECT_URL in multi mode" also contained a patch that fixed the problem.
2008-09-13fix compiler warning: defined but not usedYang Tse
2008-09-13fix compiler warning: external declaration in primary source fileYang Tse
2008-09-10Checked in some code improvements and minor fixes that I discovered in theDan Fandrich
FreeBSD ports system.
2008-09-08Dmitry Kurochkin fixed pipelining over proxy using the multi interfaceDaniel Stenberg
2008-09-06remove unnecessary typecasting of malloc()Yang Tse
2008-09-06remove unnecessary typecasting of calloc()Yang Tse
2008-08-23- Constantine Sapuntzakis fixed a bug when doing proxy CONNECT with the multiDaniel Stenberg
interface, and the proxy would send Connection: close during the authentication phase. http://curl.haxx.se/bug/view.cgi?id=2069047
2008-08-08Fixed an uninitialized variable in multi_runsingle() that could cause aDan Fandrich
request to prematurely end.
2008-06-19- Christopher Palow fixed a curl_multi_socket() issue which previous causedDaniel Stenberg
libcurl to not tell the app properly when a socket was closed (when the name resolve done by c-ares is done) and then immediately re-created and put to use again (for the actual connection). Since the closure will make the "watch status" get lost in several event-based systems libcurl will need to tell the app about this close/re-create case.
2008-06-13In checkPendPipeline() we can't be setting the TIMER_CONNECT correctly as thatDaniel Stenberg
is for the TCP connect. I changed it to TIMER_PRETRANSFER which seems to be what was intended here.
2008-05-28- Emil Romanus found a problem and helped me repeat it. It occured when usingDaniel Stenberg
the curl_multi_socket() API with HTTP pipelining enabled and could lead to the pipeline basically stalling for a very long period of time until it took off again.
2008-05-19with pipelining disabled, the state should never be set to WAITDO but ratherDaniel Stenberg
go straight to DO we had multiple states for which the internal function returned no socket at all to wait for, with the effect that libcurl calls the socket callback (when curl_multi_socket() is used) with REMOVE prematurely (as it would be added again within very shortly)