diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pipe_wrap.cc | 15 | ||||
-rw-r--r-- | src/tcp_wrap.cc | 8 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 1870837bca..6c3887d84f 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -53,6 +53,7 @@ using v8::TryCatch; using v8::Context; using v8::Arguments; using v8::Integer; +using v8::Boolean; Persistent<Function> pipeConstructor; @@ -224,17 +225,25 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { assert(req_wrap->object_.IsEmpty() == false); assert(wrap->object_.IsEmpty() == false); + bool readable, writable; + if (status) { SetErrno(uv_last_error(uv_default_loop())); + readable = writable = 0; + } else { + readable = uv_is_readable(req->handle) != 0; + writable = uv_is_writable(req->handle) != 0; } - Local<Value> argv[3] = { + Local<Value> argv[5] = { Integer::New(status), Local<Value>::New(wrap->object_), - Local<Value>::New(req_wrap->object_) + Local<Value>::New(req_wrap->object_), + Local<Value>::New(Boolean::New(readable)), + Local<Value>::New(Boolean::New(writable)) }; - MakeCallback(req_wrap->object_, "oncomplete", 3, argv); + MakeCallback(req_wrap->object_, "oncomplete", 5, argv); delete req_wrap; } diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index b2b8c5cd56..688d7d7190 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -396,13 +396,15 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) { SetErrno(uv_last_error(uv_default_loop())); } - Local<Value> argv[3] = { + Local<Value> argv[5] = { Integer::New(status), Local<Value>::New(wrap->object_), - Local<Value>::New(req_wrap->object_) + Local<Value>::New(req_wrap->object_), + Local<Value>::New(v8::True()), + Local<Value>::New(v8::True()) }; - MakeCallback(req_wrap->object_, "oncomplete", 3, argv); + MakeCallback(req_wrap->object_, "oncomplete", 5, argv); delete req_wrap; } |