diff options
author | Fedor Indutny <fedor@indutny.com> | 2015-02-23 23:09:44 +0300 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2015-02-24 22:38:21 +0300 |
commit | 1738c7783526868d86cb213414cb4d40c5a89662 (patch) | |
tree | 956d199d9e1b7f793bfe60db58bef27583ca1ebb /src/stream_wrap.cc | |
parent | e00c938d246c29897344be3b3060533bb4ad7806 (diff) | |
download | android-node-v8-1738c7783526868d86cb213414cb4d40c5a89662.tar.gz android-node-v8-1738c7783526868d86cb213414cb4d40c5a89662.tar.bz2 android-node-v8-1738c7783526868d86cb213414cb4d40c5a89662.zip |
streams: introduce StreamWrap and JSStream
Introduce a way to wrap plain-js `stream.Duplex` streams into C++
StreamBase's child class. With such method at hand it is now possible to
pass `stream.Duplex` instance as a `socket` parameter to
`tls.connect()`.
PR-URL: https://github.com/iojs/io.js/pull/926
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Diffstat (limited to 'src/stream_wrap.cc')
-rw-r--r-- | src/stream_wrap.cc | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 3b50f638eb..c8ea8d228f 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -84,7 +84,7 @@ void StreamWrap::AddMethods(Environment* env, } -int StreamWrap::GetFD() const { +int StreamWrap::GetFD() { int fd = -1; #if !defined(_WIN32) if (stream() != nullptr) @@ -94,12 +94,12 @@ int StreamWrap::GetFD() const { } -bool StreamWrap::IsAlive() const { +bool StreamWrap::IsAlive() { return HandleWrap::IsAlive(this); } -bool StreamWrap::IsClosing() const { +bool StreamWrap::IsClosing() { return uv_is_closing(reinterpret_cast<uv_handle_t*>(stream())); } @@ -114,7 +114,7 @@ AsyncWrap* StreamWrap::GetAsyncWrap() { } -bool StreamWrap::IsIPCPipe() const { +bool StreamWrap::IsIPCPipe() { return is_named_pipe_ipc(); } @@ -359,16 +359,6 @@ void StreamWrap::OnAfterWriteImpl(WriteWrap* w, void* ctx) { wrap->UpdateWriteQueueSize(); } - -const char* StreamWrap::Error() const { - return nullptr; -} - - -void StreamWrap::ClearError() { - // No-op -} - } // namespace node NODE_MODULE_CONTEXT_AWARE_BUILTIN(stream_wrap, node::StreamWrap::Initialize) |