aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
AgeCommit message (Collapse)Author
2015-05-18CURLMOPT_PIPELINE: bit 1 is for multiplexingDaniel Stenberg
2015-05-18http2: leave WAITPERFORM when conn is multiplexedDaniel Stenberg
No need to wait for our "spot" like for pipelining
2015-05-18http2: force "drainage" of streamsDaniel Stenberg
... which is necessary since the socket won't be readable but there is data waiting in the buffer.
2015-05-12bundles: merged into conncache.cDaniel Stenberg
All the existing Curl_bundle* functions were only ever used from within the conncache.c file, so I moved them over and made them static (and removed the Curl_ prefix).
2015-05-12hostcache: made all host caches use structs, not pointersDaniel Stenberg
This avoids unnecessary dynamic allocs and as this also removed the last users of *hash_alloc() and *hash_destroy(), those two functions are now removed.
2015-05-12multi: converted socket hash into non-allocated structDaniel Stenberg
avoids extra dynamic allocation
2015-05-12connection cache: avoid Curl_hash_alloc()Daniel Stenberg
... by using plain structs instead of pointers for the connection cache, we can avoid several dynamic allocations that weren't necessary.
2015-04-30curl_multi_add_handle: next is already NULLAnders Bakken
2015-04-03move Curl_share_lock and ref counting into Curl_fetch_addrStefan Bühler
2015-03-29multi: remove_handle: move pending connectionsDaniel Stenberg
If the handle removed from the multi handle happens to be the one "owning" the pipeline other transfers will be waiting indefinitely. Now we move such handles back to connect to have them race (again) for getting the connection and thus avoid hanging. Bug: http://curl.haxx.se/bug/view.cgi?id=1465 Reported-by: Jiri Dvorak
2015-03-26multi: on a request completion, check all CONNECT_PEND transfersDaniel Stenberg
... even if they don't have an associated connection anymore. It could leave the waiting transfers pending with no active one on the connection. Bug: http://curl.haxx.se/bug/view.cgi?id=1465 Reported-by: Jiri Dvorak
2015-03-17Curl_sh_entry: remove unused 'timestamp'Stefan Bühler
2015-03-17checksrc: use space after commaDaniel Stenberg
2015-03-16free: instead of Curl_safefree()Daniel Stenberg
Since we just started make use of free(NULL) in order to simplify code, this change takes it a step further and: - converts lots of Curl_safefree() calls to good old free() - makes Curl_safefree() not check the pointer before free() The (new) rule of thumb is: if you really want a function call that frees a pointer and then assigns it to NULL, then use Curl_safefree(). But we will prefer just using free() from now on.
2015-03-16Bug #149: Deletion of unnecessary checks before calls of the function "free"Markus Elfring
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.0-rc24. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2015-03-07multi: fix *getsock() with CONNECTDaniel Stenberg
The code used some happy eyeballs logic even _after_ CONNECT has been sent to a proxy, while the happy eyeball phase is already (should be) over by then. This is solved by splitting the multi state into two separate states introducing the new SENDPROTOCONNECT state. Bug: http://curl.haxx.se/mail/lib-2015-01/0170.html Reported-by: Peter Laser
2015-03-05multi: fix memory-leak on timeout (regression)Daniel Stenberg
Since 1342a96ecfe0d44, a timeout detected in the multi state machine didn't necesarily clear everything up, like formpost data. Bug: https://github.com/bagder/curl/issues/147 Reported-by: Michel Promonet Patched-by: Michel Promonet
2015-03-03mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg
... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
2015-01-07hostip: remove 'stale' argument from Curl_fetch_addr protoDaniel Stenberg
Also, remove the log output of the resolved name is NOT in the cache in the spirit of only telling when something is actually happening.
2014-12-05multi.c: Fixed compilation warningSteve Holme
multi.c:2695: warning: declaration of `exp' shadows a global declaration
2014-11-23multi.c: Fixed compilation warnings when no verbose string supportSteve Holme
warning: variable 'connection_id' set but not used warning: unused parameter 'lineno'
2014-11-19multi: inform about closed sockets before they are closedJon Spencer
When the connection code decides to close a socket it informs the multi system via the Curl_multi_closed function. The multi system may, in turn, invoke the CURLMOPT_SOCKETFUNCTION function with CURL_POLL_REMOVE. This happens after the socket has already been closed. Reorder the code so that CURL_POLL_REMOVE is called before the socket is closed.
2014-11-18debug: added new connection cache output, plus fixupsCarlo Wood
Debug output 'typo' fix. Don't print an extra "0x" in * Pipe broke: handle 0x0x2546d88, url = / Add debug output. Print the number of connections in the connection cache when adding one, and not only when one is removed. Fix typos in comments.
2014-11-18multi: move the ending condition into the loop as wellDaniel Stenberg
... as it was before I changed the loop in commit e04ccbd50. It caused test 2030 and 2032 to fail.
2014-11-18multi: Prefer we don't use CURLE_OK and NULL in comparisonsSteve Holme
2014-11-18multi_runsingle: use 'result' for local CURLcode storageDaniel Stenberg
... and assign data->result only at the end. Makes the code more compact (easier to read) and more similar to other code.
2014-11-18multi_runsingle: rename result to rcDaniel Stenberg
save 'result' for CURLcode types
2014-11-18multi: make multi_runsingle loop internallyDaniel Stenberg
simplifies the use of this function at little cost.
2014-11-18multi: when leaving for timeout, close accordinglyCarlo Wood
Fixes the problem when a transfer in a pipeline times out.
2014-11-10multi: removed Curl_multi_set_easy_connectionDaniel Stenberg
It isn't used anywhere! Reported-by: Carlo Wood
2014-10-24code cleanup: we prefer 'CURLcode result'Daniel Stenberg
... for the local variable name in functions holding the return code. Using the same name universally makes code easier to read and follow. Also, unify code for checking for CURLcode errors with: if(result) or if(!result) instead of if(result == CURLE_OK), if(CURLE_OK == result) or if(result != CURLE_OK)
2014-10-07multi_runsingle: fix possible memory leakDaniel Stenberg
Coverity CID 1202837. 'newurl' can in fact be allocated even when Curl_retry_request() returns failure so free it if need be.
2014-10-03curl_multi_remove_handle: remove dead codeDaniel Stenberg
Coverify CID 1157776. Removed a superfluous if() that always evaluated true (and an else clause that never ran), and then re-indented the function accordingly.
2014-10-02multi_runsingle: fix memory leakDaniel Stenberg
Coverity CID 1202837. There's a potential risk that 'newurl' gets overwritten when it was already pointing to allocated memory.
2014-09-07multi.c: Avoid invalid memory read after free() from commit 3c8c873252Steve Holme
As the current element in the list is free()d by Curl_llist_remove(), when the associated connection is pending, reworked the loop to avoid accessing the next element through e->next afterward.
2014-09-07multi.c: Fixed compilation warning from commit 3c8c873252Steve Holme
warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode'
2014-09-02curl_multi_cleanup: remove superfluous NULL assignsDaniel Stenberg
... as the struct is free()d in the end anyway. It was first pointed out to me that one of the ->msglist assignments were supposed to have been ->pending but was a copy and paste mistake when I realized none of the clearing of pointers had to be there.
2014-09-02multi: convert CURLM_STATE_CONNECT_PEND handling to a listDaniel Stenberg
... instead of scanning through all handles, stash only the actual handles that are in that state in the new ->pending list and scan that list only. It should be mostly empty or very short. And only used for pipelining. This avoids a rather hefty slow-down especially notable if you add many handles to the same multi handle. Regression introduced in commit 0f147887 (version 7.30.0). Bug: http://curl.haxx.se/mail/lib-2014-07/0206.html Reported-by: David Meyer
2014-08-31low-speed-limit: avoid timeout floodDaniel Stenberg
Introducing Curl_expire_latest(). To be used when we the code flow only wants to get called at a later time that is "no later than X" so that something can be checked (and another timeout be added). The low-speed logic for example could easily be made to set very many expire timeouts if it would be called faster or sooner than what it had set its own timer and this goes for a few other timers too that aren't explictiy checked for timer expiration in the code. If there's no condition the code that says if(time-passed >= TIME), then Curl_expire_latest() is preferred to Curl_expire(). If there exists such a condition, it is on the other hand important that Curl_expire() is used and not the other. Bug: http://curl.haxx.se/mail/lib-2014-06/0235.html Reported-by: Florian Weimer
2014-08-31resolve: cache lookup for async resolversMichael Wallner
While waiting for a host resolve, check if the host cache may have gotten the name already (by someone else), for when the same name is resolved by several simultanoues requests. The resolver thread occasionally gets stuck in getaddrinfo() when the DNS or anything else is crappy or slow, so when a host is found in the DNS cache, leave the thread alone and let itself cleanup the mess.
2014-07-22CONNECT: Revert Curl_proxyCONNECT back to 7.29.0 designDaniel Stenberg
This reverts commit cb3e6dfa3511 and instead fixes the problem differently. The reverted commit addressed a test failure in test 1021 by simplifying and generalizing the code flow in a way that damaged the performance. Now we modify the flow so that Curl_proxyCONNECT() again does as much as possible in one go, yet still do test 1021 with and without valgrind. It failed due to mistakes in the multi state machine. Bug: http://curl.haxx.se/bug/view.cgi?id=1397 Reported-by: Paul Saab
2014-07-02progress callback: skip last callback update on errorsRay Satiro
When an error has been detected, skip the final forced call to the progress callback by making sure to pass the current return code variable in the Curl_done() call in the CURLM_STATE_DONE state. This avoids the "extra" callback that could occur even if you returned error from the progress callback. Bug: http://curl.haxx.se/mail/lib-2014-06/0062.html Reported by: Jonathan Cardoso Machado
2014-05-22bits.close: introduce connection close trackingDaniel Stenberg
Make all code use connclose() and connkeep() when changing the "close state" for a connection. These two macros take a string argument with an explanation, and debug builds of curl will include that in the debug output. Helps tracking connection re-use/close issues.
2014-05-15timers: fix timer regression involving redirects / reconnectsDaniel Stenberg
In commit 0b3750b5c23c25f (released in 7.36.0) we fixed a timeout issue but instead broke the timings. To fix this, I introduce a new timestamp to use for the timeouts and restored the previous timestamp and timestamp position so that the old timer functionality is restored. In addition to that, that change also broke connection timeouts for when more than one connect was used (as it would then count the total time from the first connect and not for the most recent one). Now Curl_timeleft() has been modified so that it checks against different start times depending on which timeout it checks. Test 1303 is updated accordingly. Bug: http://curl.haxx.se/mail/lib-2014-05/0147.html Reported-by: Ryan Braud
2014-05-05curl_multi_cleanup: ignore SIGPIPE betterJeff King
When looping and closing each individual connection left open, the SIGPIPE ignoring was not done and could thus lead to death by signal 13. Bug: http://thread.gmane.org/gmane.comp.version-control.git/238242
2014-04-26INFILESIZE: fields in UserDefined must not be changed run-timeDaniel Stenberg
set.infilesize in this case was modified in several places, which could lead to repeated requests using the same handle to get unintendent/wrong consequences based on what the previous request did!
2014-04-19multi.c: fix possible invalid memory access in case nfds overflowsMarc Hoersken
ufds might not be allocated in case nfds overflows to zero while extra_nfds is still non-zero. udfs is then accessed within the extra_nfds-based for loop.
2014-03-03multi_runsingle: move timestamp into INITDaniel Stenberg
Setting the TIMER_STARTSINGLE timestamp first in CONNECT has the drawback that for actions that go back to the CONNECT state, the time stamp is reset and for the multi_socket API there's no corresponding Curl_expire() then so the timeout logic gets wrong! Reported-by: Brad Spencer Bug: http://curl.haxx.se/mail/lib-2014-02/0036.html
2014-02-17multi: ignore sigpipe internallyDaniel Stenberg
When the multi API is used we must also ignore SIGPIPE signals when caused by things we do, like they can easily be generated by OpenSSL.
2014-02-17ConnectionDone: default maxconnects to 4 x number of easy handlesShao Shuchao
... as documented!