summaryrefslogtreecommitdiff
path: root/src/stream_wrap.h
Commit message (Collapse)AuthorAgeFilesLines
* src: make build pass with GCC < 4.5Julien Gilli2015-01-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Building node with GCC > 4.4 on CentOS makes the node binary depend on a more recent version of the C/C++ runtime that is not installed by default on these older CentOS platforms, and probably on other platforms as well. Building node with the default gcc and g++ compilers that come with these older versions of CentOS allows to ship a node binary that runs out of the box on these setups with older C/C++ runtimes. This change works around a bug that was fixed in GCC 4.5. Versions of GCC < 4.5 would not support using the injected-class-name of a template base class as a type name. This change also disables aliasing optimizations for toolchains using GCC <= 4.4 as they're not able to deal with the aliasing in the queue implementation used by libuv and node (see src/queue.h). Fixes #9079. PR: #9098 PR-URL: https://github.com/joyent/node/pull/9098 Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* async-wrap: explicitly pass parentTrevor Norris2014-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | When instantiating a new AsyncWrap allow the parent AsyncWrap to be passed. This is useful for cases like TCP incoming connections, so the connection can be tied to the server receiving the connection. Because the current architecture instantiates the *Wrap inside a v8::FunctionCallback, the parent pointer is currently wrapped inside a new v8::External every time and passed as an argument. This adds ~80ns to instantiation time. A future optimization would be to add the v8::External as the data field when creating the v8::FunctionTemplate, change the pointer just before making the call then NULL'ing it out afterwards. This adds enough code complexity that it will not be attempted until the current approach demonstrates it is a bottle neck. 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: remove unnecessary template parameterTrevor Norris2014-12-051-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 wrap's now use actual FunctionTemplateTrevor Norris2014-12-051-2/+21
| | | | | | | | | | | | | | | 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>
* tls_wrap: fix use after freeFedor Indutny2014-09-031-3/+5
| | | | | Do not free TLSCallbacks from StreamWrap. TLSCallbacks is bound to a V8 object and should be collected by V8's GC.
* stream_wrap: Add support to write binary stringsTrevor Norris2014-09-031-0/+2
| | | | | | | | node::StringBytes::Write() has appropriate support to write strings with 'binary' encoding. So expose that API through StreamWrap and allow inheriting classes to use it. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* src: update from uv_read2_start removalTimothy J Fontaine2014-03-101-4/+0
| | | | | | Previously if you wanted to be notified of pending handles for pipes you needed to use uv_read2_start, however in v0.11.22 you can query for pending handles independently.
* src: make stdout/sterr pipes blockingAlexis Campailla2014-02-261-0/+2
| | | | | | | | | Expose `setBlocking` on Pipe's and if a pipe is being created for stdio on windows then make the pipes blocking. This fixes test-stream2-stderr-sync.js on Windows. Fixes #3584
* async_wrap: add provider types/pass to constructorTrevor Norris2014-02-051-1/+4
| | | | | | | 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>
* stream_wrap: use `uv_try_write` where possibleFedor Indutny2014-01-291-0/+3
| | | | | Use `uv_try_write` for string and buffer writes, thus avoiding to do allocations and copying in some of the cases.
* tls_wrap: propagate errors to write callbacksFedor Indutny2014-01-241-0/+1
| | | | fix #6903
* async-wrap: integrate with WeakObjectTrevor Norris2013-10-311-2/+0
| | | | | Making WeakObject inherit from AsyncWrap allows us to peak into almost all the MakeCallback calls in Node internals.
* cpplint: disallow comma-first in C++Fedor Indutny2013-10-171-2/+2
|
* src: add multi-context supportBen Noordhuis2013-09-061-7/+7
| | | | | | | | | | | | | | | | | | | | | | | 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.
* uv: upgrade to v0.11.12Ben Noordhuis2013-09-031-8/+18
| | | | | * upgrade deps/uv/ to v0.11.12. * update files in src/ after a libuv API change.
* stream_wrap: add handle type checkersBen Noordhuis2013-08-071-0/+13
| | | | | | Add is_named_pipe(), is_named_pipe_ipc() and is_tcp() and update the code base to use those rather than `stream->type == UV_FOO` and `reinterpret_cast<uv_pipe_t*>(handle)->ipc` style checks.
* stream_wrap: use getters, not direct field accessBen Noordhuis2013-08-071-17/+28
| | | | | | | | Hide member fields behind getters. Make the fields themselves const in the sense that the pointer is non-assignable - the pointed to object remains mutable. Makes reasoning about lifecycle and mutability a little easier.
* src: lint c++ codeFedor Indutny2013-07-311-5/+5
|
* src, lib: update after internal api changeBen Noordhuis2013-07-201-1/+2
| | | | | | | | Libuv now returns errors directly. Make everything in src/ and lib/ follow suit. The changes to lib/ are not strictly necessary but they remove the need for the abominations that are process._errno and node::SetErrno().
* lib, src: upgrade after v8 api changeBen Noordhuis2013-07-061-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big commit that touches just about every file in the src/ directory. The V8 API has changed in significant ways. The most important changes are: * Binding functions take a const v8::FunctionCallbackInfo<T>& argument rather than a const v8::Arguments& argument. * Binding functions return void rather than v8::Handle<v8::Value>. The return value is returned with the args.GetReturnValue().Set() family of functions. * v8::Persistent<T> no longer derives from v8::Handle<T> and no longer allows you to directly dereference the object that the persistent handle points to. This means that the common pattern of caching oft-used JS values in a persistent handle no longer quite works, you first need to reconstruct a v8::Local<T> from the persistent handle with the Local<T>::New(isolate, persistent) factory method. A handful of (internal) convenience classes and functions have been added to make dealing with the new API a little easier. The most visible one is node::Cached<T>, which wraps a v8::Persistent<T> with some template sugar. It can hold arbitrary types but so far it's exclusively used for v8::Strings (which was by far the most commonly cached handle type.)
* slab_allocator: remove SlabAllocatorTrevor Norris2013-07-031-3/+0
| | | | | | | | | Now that Buffer instantiation has improved, the SlabAllocator is an unnecessary layer of complexity preventing further performance optimizations. Currently there is a small performance loss with very small stream requests, but this will soon be addressed.
* stream_wrap: introduce StreamWrapCallbacksFedor Indutny2013-06-151-1/+78
| | | | | StreamWrapCallbacks is a helper class for incepting into uv_stream_t* management process.
* src: simplify HandleWrap initializationBen Noordhuis2013-05-301-1/+0
|
* Merge remote-tracking branch 'ry/v0.10' into masterisaacs2013-05-171-17/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/uv/ChangeLog deps/uv/config-unix.mk deps/uv/src/unix/stream.c deps/uv/src/version.c deps/uv/uv.gyp src/node.cc src/node_buffer.cc src/node_crypto.cc src/node_version.h src/stream_wrap.cc src/stream_wrap.h
| * src: Use StringBytes in StreamWrapisaacs2013-05-141-9/+2
| |
* | stream_wrap: remove unused arg from WriteBufferTrevor Norris2013-05-071-3/+1
| | | | | | | | | | WriteBuffer was changed in the cork/uncork implementation (60ed2c54). The unused argument has been removed.
* | net: implement ._writev for .cork/uncork() supportFedor Indutny2013-04-271-3/+20
|/ | | | | Add Writev method to StreamWrap class for writing mixed array of strings and buffers. Expose this method for TCP class.
* stream_wrap, udp_wrap: add read-only fd propertyBen Noordhuis2013-02-131-0/+3
| | | | | | | | Expose the file descriptor as a read-only property on the internal handle objects. Intended for debugging purposes, not part of the API proper. The property is always null on Windows. Fixes #4754.
* deps: upgrade libuv to a478847Ben Noordhuis2012-05-221-1/+0
| | | | | The event loop's reference counting scheme in this version of libuv has changed. Update the libuv bindings to reflect that fact.
* stream_wrap: fix compilation errorsBen Noordhuis2012-05-091-0/+8
|
* Optimize writing strings with Socket.writeBert Belder2012-05-091-1/+8
|
* core: use proper #include directivesBen Noordhuis2012-03-101-3/+3
|
* Add missing copyright headersRyan Dahl2011-11-021-0/+21
|
* uv_write2 uv_read2_start bindingRyan Dahl2011-10-061-1/+6
|
* stream_wrap: update after libuv API changeBen Noordhuis2011-08-241-1/+1
|
* stdio binding + javascript to enable process.stdin.listen()Igor Zinkovsky2011-07-271-0/+3
|
* net_uv: properly initialize writeQueueSizeRyan Dahl2011-07-191-1/+1
| | | | Fixes simple/test-tcp-wrap-listen.js
* Abstract out HandleWrap classRyan Dahl2011-07-181-6/+7
|
* Abstract StreamWrap from TCPWrapRyan Dahl2011-07-181-0/+42