};
-function afterConnect(status, handle, req) {
+function afterConnect(status, handle, req, readable, writable) {
var self = handle.socket;
// callback may come after call to destroy
self._connecting = false;
if (status == 0) {
- self.readable = self.writable = true;
+ self.readable = readable;
+ self.writable = writable;
timers.active(self);
- handle.readStart();
+ if (self.readable) {
+ handle.readStart();
+ }
self.emit('connect');
using v8::Context;
using v8::Arguments;
using v8::Integer;
+using v8::Boolean;
Persistent<Function> pipeConstructor;
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;
}
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;
}