summaryrefslogtreecommitdiff
path: root/lib/asyn-ares.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: more conn->data cleanupsDaniel Stenberg2021-01-191-1/+1
| | | | Closes #6479
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* asyn-ares: remove Curl_ prefix from static functionsDaniel Stenberg2021-01-141-4/+4
|
* asyn: use 'struct thread_data *' instead of 'void *'Daniel Stenberg2020-11-231-12/+11
| | | | | | | | | | To reduce use of types that can't be checked at compile time. Also removes several typecasts. ... and rename the struct field from 'os_specific' to 'tdata'. Closes #6239 Reviewed-by: Jay Satiro
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* symbian: drop supportDaniel Stenberg2020-09-221-2/+2
| | | | | | | | | The OS is deprecated. I see no traces of anyone having actually built curl for Symbian after 2012. The public headers are unmodified. Closes #5989
* asyn-ares: correct some bad commentsDaniel Stenberg2020-08-151-4/+4
| | | | Closes #5812
* timeouts: move ms timeouts to timediff_t from int and longMarc Hoersken2020-06-061-5/+9
| | | | | | | | | | | | | Now that all functions in select.[ch] take timediff_t instead of the limited int or long, we can remove type conversions and related preprocessor checks to silence compiler warnings. Avoiding conversions from time_t was already done in 842f73de. Based upon #5262 Supersedes #5214, #5220 and #5221 Follow up to #5343 and #5479 Closes #5490
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-151-8/+9
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* asyn-*: remove support for never-used NULL entry pointersDaniel Stenberg2020-05-031-14/+12
| | | | | | | ... and instead convert those to asserts to make sure they are truly never NULL. Closes #5324
* global_init: move the IPv6 works status bool to multi handleDaniel Stenberg2020-01-281-1/+1
| | | | | | | | | Previously it was stored in a global state which contributed to curl_global_init's thread unsafety. This boolean is now instead figured out in curl_multi_init() and stored in the multi handle. Less effective, but thread safe. Closes #4851
* fix: Copyright year out of date, should be 2020Daniel Stenberg2020-01-101-1/+1
| | | | Follow-up to 875314ed0bf3b
* hostip: move code to resolve IP address literals to `Curl_resolv`Marcel Raad2020-01-101-15/+0
| | | | | | | | | | | | | | | | The code was duplicated in the various resolver backends. Also, it was called after the call to `Curl_ipvalid`, which matters in case of `CURLRES_IPV4` when called from `connect.c:bindlocal`. This caused test 1048 to fail on classic MinGW. The code ignores `conn->ip_version` as done previously in the individual resolver backends. Move the call to the `resolver_start` callback up to appease test 655, which wants it to be called also for literal addresses. Closes https://github.com/curl/curl/pull/4798
* cleanup: remove the 'numsocks' argument used in many placesDaniel Stenberg2019-07-301-4/+2
| | | | | | | | | It was used (intended) to pass in the size of the 'socks' array that is also passed to these functions, but was rarely actually checked/used and the array is defined to a fixed size of MAX_SOCKSPEREASYHANDLE entries that should be used instead. Closes #4169
* c-ares: honor port numbers in CURLOPT_DNS_SERVERSJames Brown2019-06-241-0/+4
| | | | | | | By using ares_set_servers_ports_csv on new enough c-ares. Fixes #4066 Closes #4067
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-161-3/+1
| | | | | | | | | They serve very little purpose and mostly just add noise. Most of them have been around for a very long time. I read them all before removing or rephrasing them. Ref: #3876 Closes #3883
* build: fix "clarify calculation precedence" warningsMarcel Raad2019-05-121-2/+2
| | | | | | | Codacy/CppCheck warns about this. Consistently use parentheses as we already do in some places to silence the warning. Closes https://github.com/curl/curl/pull/3866
* build: fix Codacy/CppCheck warningsMarcel Raad2019-04-111-1/+1
| | | | | | | | | | - remove unused variables - declare conditionally used variables conditionally - suppress unused variable warnings in the CMake tests - remove dead variable stores - consistently use WIN32 macro to detect Windows Closes https://github.com/curl/curl/pull/3739
* resolve: apply Happy Eyeballs philosophy to parallel c-ares queriesBrad Spencer2019-03-271-0/+95
| | | | Closes #3699
* curl_multi_remove_handle() don't block terminating c-ares requestsBrad Spencer2019-01-071-4/+15
| | | | | | | | | Added Curl_resolver_kill() for all three resolver modes, which only blocks when necessary, along with test 1592 to confirm curl_multi_remove_handle() doesn't block unless it must. Closes #3428 Fixes #3371
* ares: remove fd from multi fd set when ares is about to close the fdRomain Fliedel2018-11-201-7/+26
| | | | | | | | | | | | | | | | | | | When using c-ares for asyn dns, the dns socket fd was silently closed by c-ares without curl being aware. curl would then 'realize' the fd has been removed at next call of Curl_resolver_getsock, and only then notify the CURLMOPT_SOCKETFUNCTION to remove fd from its poll set with CURL_POLL_REMOVE. At this point the fd is already closed. By using ares socket state callback (ARES_OPT_SOCK_STATE_CB), this patch allows curl to be notified that the fd is not longer needed for neither for write nor read. At this point by calling Curl_multi_closed we are able to notify multi with CURL_POLL_REMOVE before the fd is actually closed by ares. In asyn-ares.c Curl_resolver_duphandle we can't use ares_dup anymore since it does not allow passing a different sock_state_cb_data Closes #3238
* ares: check for NULL in completed-callbackDaniel Stenberg2018-07-111-8/+10
|
* multi: fix memory leak when stopped during name resolveDaniel Stenberg2018-06-161-8/+11
| | | | | | | | | | | | When the application just started the transfer and then stops it while the name resolve in the background thread hasn't completed, we need to wait for the resolve to complete and then cleanup data accordingly. Enabled test 1553 again and added test 1590 to also check when the host name resolves successfully. Detected by OSS-fuzz. Closes #1968
* build: remove HAVE_LIMITS_H checkJay Satiro2018-01-051-2/+0
| | | | | | | | .. because limits.h presence isn't optional, it's required by C89. Ref: http://port70.net/~nsz/c/c89/c89-draft.html#2.2.4.2 Closes https://github.com/curl/curl/pull/2215
* Curl_timeleft: change return type to timediff_tDaniel Stenberg2017-10-281-1/+1
| | | | | | | | returning 'time_t' is problematic when that type is unsigned and we return values less than zero to signal "already expired", used in several places in the code. Closes #2021
* resolvers: only include anything if neededMarcel Raad2017-10-271-8/+8
| | | | | | This avoids warnings about unused stuff. Closes https://github.com/curl/curl/pull/2023
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-2/+2
| | | | | | | | | | ... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
* timediff: return timediff_t from the time diff functionsDaniel Stenberg2017-10-251-1/+1
| | | | | | | | | | | | | | | ... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-2/+2
|
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-281-2/+2
| | | | | | | | | ... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693
* asyn-ares: s/Curl_expire_latest/Curl_expireDaniel Stenberg2017-06-081-1/+1
|
* time: fix type conversions and compiler warningsMichael Kaufmann2017-05-241-3/+7
| | | | | | | | | Fix bugs and compiler warnings on systems with 32-bit long and 64-bit time_t. Reviewed-by: Daniel Stenberg Closes #1499
* multi: use a fixed array of timers instead of mallocDaniel Stenberg2017-05-101-1/+1
| | | | | | | | | | ... since the total amount is low this is faster, easier and reduces memory overhead. Also, Curl_expire_done() can now mark an expire timeout as done so that it never times out. Closes #1472
* multi: assign IDs to all timers and make each timer singletonDaniel Stenberg2017-05-101-1/+1
| | | | | | | A) reduces the timeout lists drastically B) prevents a lot of superfluous loops for timers that expires "in vain" when it has actually already been extended to fire later on
* ares: Curl_resolver_wait_resolv: clear *entry first in functionDaniel Stenberg2017-03-071-0/+3
|
* ares: better error return on timeoutsDaniel Stenberg2017-03-071-12/+9
| | | | | | Assisted-by: Ray Satiro Bug: https://curl.haxx.se/mail/lib-2017-03/0009.html
* ares: return error at once if timed out before name resolve startsDaniel Stenberg2017-03-061-1/+6
| | | | | Pointed-out-by: Ray Satiro Bug: https://curl.haxx.se/mail/lib-2017-03/0004.html
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-2/+2
| | | | In order to make the code style more uniform everywhere
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-8/+8
|
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* Revert "cleanup: general removal of TODO (and similar) comments"Daniel Stenberg2015-11-241-0/+1
| | | | | | | This reverts commit 64e959ffe37c436503f9fed1ce2d6ee6ae50bd9a. Feedback-by: Dan Fandrich URL: http://curl.haxx.se/mail/lib-2015-11/0062.html
* cleanup: general removal of TODO (and similar) commentsDaniel Stenberg2015-11-131-1/+0
| | | | | | They tend to never get updated anyway so they're frequently inaccurate and we never go back to revisit them anyway. We document issues to work on properly in KNOWN_BUGS and TODO instead.
* checksrc: use space after commaDaniel Stenberg2015-03-171-3/+3
|
* free: instead of Curl_safefree()Daniel Stenberg2015-03-161-2/+2
| | | | | | | | | | | | 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.
* Bug #149: Deletion of unnecessary checks before calls of the function "free"Markus Elfring2015-03-161-2/+1
| | | | | | | | | | | 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>
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-4/+2
| | | | | ... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
* asyn-ares: We prefer use of 'CURLcode result'Steve Holme2014-12-141-8/+8
|
* ares::Curl_resolver_cancel: skip checking for NULL connDaniel Stenberg2014-10-071-1/+1
| | | | | Coverity CID 1243581. 'conn' will never be NULL here, and if it would be the subsequent statement would dereference it!
* low-speed-limit: avoid timeout floodDaniel Stenberg2014-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | 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