summaryrefslogtreecommitdiff
path: root/src/cares_wrap.cc
Commit message (Collapse)AuthorAgeFilesLines
* async-wrap: add provider id and object info cbTrevor Norris2015-06-171-2/+26
| | | | | | | | | | | | | | | | | | | Re-add the wrapper class id to AsyncWrap instances so they can be tracked directly in a heapdump. Previously the class id was given without setting the heap dump wrapper class info provider. Causing a segfault when a heapdump was taken. This has been added, and the label_ set to the given provider name so each instance can be identified. The id will not be set of the passed object has no internal field count. As the class pointer cannot be retrieved from the object. In order to properly report the allocated size of each class, the new pure virtual method self_size() has been introduces. PR-URL: https://github.com/nodejs/io.js/pull/1896 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: fix intermittent SIGSEGV in resolveTxtEvan Lucas2015-02-251-2/+3
| | | | | | | | Fixes a SIGSEGV by making sure `txt_chunk` is not empty before setting it on `txt_records` PR-URL: https://github.com/iojs/io.js/pull/960 Reviewed-By: Rod Vagg <rod@vagg.org>
* src: switch from QUEUE to intrusive listBen Noordhuis2015-02-111-1/+2
| | | | | | | | | This commit also breaks up req_wrap.h into req-wrap.h and req-wrap-inl.h to work around a circular dependency issue in env.h. PR-URL: https://github.com/iojs/io.js/pull/667 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* src: define AI_V4MAPPED for OpenBSDAaron Bieber2015-01-151-0/+3
| | | | | | | | OpenBSD doesn't define AI_V4MAPPED by default. Defining it to 0 as done with other ports. PR-URL: https://github.com/iojs/io.js/pull/427 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* Remove excessive copyright/license boilerplateisaacs2015-01-121-21/+0
| | | | | | | The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
* src: pass Isolate to node::Utf8Value constructorTrevor Norris2015-01-071-5/+5
| | | | | | | | Initial attempt to remove all uses of Isolate::GetCurrent(). Still exists a few locations, but this works out a heavy usage. PR-URL: https://github.com/iojs/io.js/pull/244 Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
* src: remove unnecessary template parameterTrevor Norris2014-12-091-2/+2
| | | | | | | | | | | The template class information is received via the type of the first argument. So there is no need to use Wrap<T>(handle). PR-URL: https://github.com/joyent/node/pull/8110 Signed-off-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com> Reviewed-by: Alexis Campailla <alexis@janeasystems.com> Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
* src: all wraps now use actual FunctionTemplateTrevor Norris2014-12-091-11/+53
| | | | | | | | | | | | | | | Instead of simply creating a new v8::Object to contain the connection information, instantiate a new instance of a FunctionTemplate. This will allow future improvements for debugging and performance probes. Additionally, the "provider" argument in the ReqWrap constructor is no longer optional. PR-URL: https://github.com/joyent/node/pull/8110 Signed-off-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com> Reviewed-by: Alexis Campailla <alexis@janeasystems.com> Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
* Merge remote-tracking branch 'joyent/v0.12' into v0.12Ben Noordhuis2014-11-221-0/+2
|\ | | | | | | | | | | | | | | | | Conflicts: Makefile deps/v8/src/base/platform/platform.h PR-URL: https://github.com/node-forward/node/pull/65 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| * dns: propagate domain for c-ares methodsChris Dickinson2014-11-171-0/+2
| | | | | | | | | | | | Fixes: https://github.com/joyent/node/issues/5471 PR-URL: https://github.com/joyent/node/pull/8732 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
| * deps: re-implement debugger-agentFedor Indutny2014-10-081-0/+18
| | | | | | | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* | src: mark virtual functions with override keywordBen Noordhuis2014-10-231-23/+23
| | | | | | | | | | | | Add `override` keywords where appropriate. Makes maintenance easier because the compiler will shout at you when a base class changes in an incompatible way.
* | src: replace NULL with nullptrBen Noordhuis2014-10-231-20/+20
| | | | | | | | | | | | | | | | | | | | Now that we are building with C++11 features enabled, replace use of NULL with nullptr. The benefit of using nullptr is that it can never be confused for an integral type because it does not support implicit conversions to integral types except boolean - unlike NULL, which is defined as a literal `0`.
* | src: attach env directly to api functionsBen Noordhuis2014-10-131-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Attach the per-context execution environment directly to API functions. Rationale: * Gets node one step closer to multi-isolate readiness. * Avoids multi-context confusion, e.g. when the caller and callee live in different contexts. * Avoids expensive calls to pthread_getspecific() on platforms where V8 does not know how to use the thread-local storage directly. (Linux, the BSDs.) PR-URL: https://github.com/node-forward/node/pull/18 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | src: remove unused Environment::GetCurrent() callsBen Noordhuis2014-10-131-2/+0
| | | | | | | | | | | | | | | | | | Remove a few Environment::GetCurrent() calls that g++ failed to detect were not used for anything. The return value was assigned to a local variable but not used meaningfully. PR-URL: https://github.com/node-forward/node/pull/18 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | src: replace assert() with CHECK()Ben Noordhuis2014-10-121-29/+28
| | | | | | | | | | | | | | | | | | | | | | Mechanically replace assert() statements with UNREACHABLE(), CHECK(), or CHECK_{EQ,NE,LT,GT,LE,GE}() statements. The exceptions are src/node.h and src/node_object_wrap.h because they are public headers. PR-URL: https://github.com/node-forward/node/pull/16 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | src: remove unnecessary HandleScopesBen Noordhuis2014-10-121-7/+0
| | | | | | | | | | | | | | | | API callback functions don't need to create a v8::HandleScope instance because V8 already creates one in the JS->C++ adapter frame. PR-URL: https://github.com/node-forward/node/pull/16 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | deps: re-implement debugger-agentFedor Indutny2014-10-081-0/+18
|/ | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* dns: fix GetAddrInfo assertTrevor Norris2014-08-041-2/+1
| | | | | | | | | | | | The method GetAddrInfo() is used by more than just dns.lookup(), and in those cases a third argument isn't passed. This caused the following check to abort: assert(args[3]->IsInt32()); Fixes: 4306786 "net: don't prefer IPv4 addresses during resolution" Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* net: don't prefer IPv4 addresses during resolutioncjihrig2014-08-041-0/+8
| | | | | | | | | | | Currently the address resolution family defaults to IPv4. Instead remove the preference and instead resolve to a family suitable for the host. Expose the getaddrinfo flags and allow them to be passed. Add documentation about new flags. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* dns: introduce lookupService functionSaúl Ibarra Corretgé2014-06-271-0/+66
| | | | | | | Uses getnameinfo to resolve an address an port into a hostname and service. Signed-off-by: Fedor Indutny <fedor@indutny.com>
* Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2014-06-101-4/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/v8/src/api.cc deps/v8/src/unicode-inl.h deps/v8/src/unicode.h lib/_stream_readable.js lib/http.js src/cares_wrap.cc src/node.cc src/node_crypto.cc src/node_dtrace.cc src/node_file.cc src/node_stat_watcher.cc src/node_version.h src/process_wrap.cc src/string_bytes.cc src/string_bytes.h src/udp_wrap.cc src/util.h test/simple/test-buffer.js test/simple/test-stream2-compatibility.js
| * src: replace usage of String::Utf8ValueTimothy J Fontaine2014-06-061-3/+5
| | | | | | | | | | v8::String::Utf8Value previously could allow invalid surrogates when interpreting values.
* | src: replace CONTAINER_OF with type-safe functionBen Noordhuis2014-05-301-2/+3
| | | | | | | | | | | | | | Replace the CONTAINER_OF macro with a template function that is as type-safe as a reinterpret_cast<> of an arbitrary pointer can be made. Signed-off-by: Fedor Indutny <fedor@indutny.com>
* | deps: provide TXT chunk info in c-aresFedor Indutny2014-04-241-2/+13
| | | | | | | | | | | | | | Provide more information in `ares_txt_reply` to coalesce chunks from the same record into one string. fix #7367
* | src: update uv callbacks after API changesSaúl Ibarra Corretgé2014-04-071-1/+1
| | | | | | | | | | async, timer, prepare, idle and check handles no longer get a status parameter since they can never fail.
* | src: update to v8 3.24 APIsFedor Indutny2014-03-131-37/+38
| |
* | src: remove `node_isolate` from sourceFedor Indutny2014-02-221-79/+69
| | | | | | | | fix #6899
* | async_wrap: add provider types/pass to constructorTrevor Norris2014-02-051-2/+5
| | | | | | | | | | | | | | These will be used to allow users to filter for which types of calls they wish their callbacks to run. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* | node: register modules from DSO constructorsKeith M Wesolowski2014-01-271-1/+1
| | | | | | | | | | | | | | Built-in modules should be automatically registered, replacing the static module list. Add-on modules should also be automatically registered via DSO constructors. This improves flexibility in adding built-in modules and is also a prerequisite to pure-C addon modules.
* | dns: add resolveSoa and 'SOA' rrtypeTuğrul Topuz2013-12-311-0/+54
| | | | | | | | | | You can now query for SOA records by either passing 'SOA' to `resolve` or by using the new `resolveSoa`
* | src: remove unused import in cares_wrap.ccBen Noordhuis2013-11-141-1/+0
| |
* | src: use Context::Scope objects in cares_wrap.ccBen Noordhuis2013-11-121-9/+18
| | | | | | | | | | Enter the context explicitly, don't rely on the fact that there is a Context::Scope a few stack frames below because it may be gone someday
* | src: fix Context::Scope usageBen Noordhuis2013-11-121-4/+4
| | | | | | | | | | env->context() may or may not create a new Local. It currently does not but don't depend on that behavior, create a HandleScope first.
* | src: fix Environment::GetCurrent() usageBen Noordhuis2013-11-111-4/+4
| | | | | | | | | | | | Create a HandleScope before calling the Environment::GetCurrent() that takes a v8::Isolate* as an argument because it creates a handle with the call to v8::Isolate::CurrentContext().
* | src: remove container_of, use CONTAINER_OFBen Noordhuis2013-11-081-2/+2
| | | | | | | | | | | | | | | | CONTAINER_OF was introduced a while ago but was not used consistently everywhere yet. This commit fixes that. Why CONTAINER_OF instead of container_of? The former makes it crystal clear that it's a macro, not a function.
* | cares: add AsyncListener supportTrevor Norris2013-10-311-36/+9
| |
* | cpplint: disallow if one-linersFedor Indutny2013-10-171-4/+8
| |
* | cares_wrap: remove superfluous 'this' keywordBen Noordhuis2013-10-141-8/+8
| |
* | dns: fix c-ares error reporting regressionBen Noordhuis2013-09-201-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test case from the previous commit exposed a regression in the way that c-ares errors are reported to JS land. Said regression was introduced in commit 756b622 ("src: add multi-context support"). Fixes the following test failure: $ out/Release/node test/simple/test-dns-regress-6244 util.js:675 var errname = uv.errname(err); ^ Error: err >= 0 at Object.exports._errnoException (util.js:675:20) at errnoException (dns.js:43:15) at Object.onresolve [as oncomplete] (dns.js:145:19) lib/dns.js erroneously assumed that the error code was a libuv error code when it's really a c-ares status code. Libuv handles getaddrinfo() style lookups (which is by far the most common type of lookup), that's why this bug wasn't discovered earlier.
* | src: add multi-context supportBen Noordhuis2013-09-061-89/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes it possible to use multiple V8 execution contexts within a single event loop. Put another way, handle and request wrap objects now "remember" the context they belong to and switch back to that context when the time comes to call into JS land. This could have been done in a quick and hacky way by calling v8::Object::GetCreationContext() on the wrap object right before making a callback but that leaves a fairly wide margin for bugs. Instead, we make the context explicit through a new Environment class that encapsulates everything (or almost everything) that belongs to the context. Variables that used to be a static or a global are now members of the aforementioned class. An additional benefit is that this approach should make it relatively straightforward to add full isolate support in due course. There is no JavaScript API yet but that will be added in the near future. This work was graciously sponsored by GitHub, Inc.
* | cares_wrap: drop UV_HANDLE_FIELDS from ares_task_tBen Noordhuis2013-08-271-1/+1
| | | | | | | | | | UV_HANDLE_FIELDS is a libuv implementation detail. The ares_task_t struct only uses the uv_loop_t* field so be explicit about that.
* | src: don't obj->Set(Integer::New(...), val)Ben Noordhuis2013-08-121-40/+30
| | | | | | | | | | | | | | | | Don't create an Integer when setting a numeric index on an object or an array, use the version of v8::Object::Set() that takes an uint32_t. Change the types of the variables from int to uint32_t and clean up some code consistency issues while we're here.
* | cares_wrap: remove unused function getHostByName()Ben Noordhuis2013-08-121-26/+0
| | | | | | | | Hasn't been used in ages. Also remove its (already disabled) test.
* | cares_wrap: don't set oncomplete property from c++Ben Noordhuis2013-08-121-11/+0
| | | | | | | | | | | | | | | | | | Don't set the oncomplete property in src/cares_wrap.cc, we can do it just as easily in lib/dns.js. Switch two closures to the 'function with _this_ object' model. Makes it impossible for an overzealous closure to capture too much context and accidentally hold on to too much memory.
* | src: use v8::String::NewFrom*() functionsBen Noordhuis2013-08-091-30/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change calls to String::New() and String::NewSymbol() to their respective one-byte, two-byte and UTF-8 counterparts. * Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and turns it into a v8::Local<v8::String>. * Add helper functions that make v8::String::NewFromOneByte() easier to work with. Said function expects a `const uint8_t*` but almost every call site deals with `const char*` or `const unsigned char*`. Helps us avoid doing reinterpret_casts all over the place. * Code that handles file system paths keeps using UTF-8 for backwards compatibility reasons. At least now the use of UTF-8 is explicit. * Remove v8::String::NewSymbol() entirely. Almost all call sites were effectively minor de-optimizations. If you create a string only once, there is no point in making it a symbol. If you are create the same string repeatedly, it should probably be cached in a persistent handle.
* | src: use static_cast for void-to-T castsBen Noordhuis2013-08-031-2/+1
| | | | | | | | | | Code cleanup, replace a few uses of reinterpret_cast<T*>(void_ptr) with static_cast<T*>(void_ptr).
* | src: remove non-isolate PersistentToLocal()Ben Noordhuis2013-08-021-1/+1
| | | | | | | | | | There is no need for it and it's a tiny bit slower than the version of PersistentToLocal() that takes a v8::Isolate* as its first argument.
* | src: more lint after cpplint tighteningBen Noordhuis2013-07-311-5/+5
| | | | | | | | | | Commit 847c6d9 adds a 'project headers before system headers' check to cpplint. Update the files in src/ to make the linter pass again.
* | src: lint c++ codeFedor Indutny2013-07-311-19/+22
| |