|
|
@ -28,7 +28,9 @@ |
|
|
|
TCPWrap* wrap = \ |
|
|
|
static_cast<TCPWrap*>(args.Holder()->GetPointerFromInternalField(0)); \ |
|
|
|
if (!wrap) { \ |
|
|
|
SetErrno(UV_EBADF); \ |
|
|
|
uv_err_t err; \ |
|
|
|
err.code = UV_EBADF; \ |
|
|
|
SetErrno(err); \ |
|
|
|
return scope.Close(Integer::New(-1)); \ |
|
|
|
} |
|
|
|
|
|
|
@ -149,7 +151,7 @@ Handle<Value> TCPWrap::GetSockName(const Arguments& args) { |
|
|
|
|
|
|
|
Local<Object> sockname = Object::New(); |
|
|
|
if (r != 0) { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
} else { |
|
|
|
family = address.ss_family; |
|
|
|
|
|
|
@ -191,7 +193,7 @@ Handle<Value> TCPWrap::GetPeerName(const Arguments& args) { |
|
|
|
|
|
|
|
Local<Object> sockname = Object::New(); |
|
|
|
if (r != 0) { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
} else { |
|
|
|
family = address.ss_family; |
|
|
|
|
|
|
@ -229,7 +231,7 @@ Handle<Value> TCPWrap::Bind(const Arguments& args) { |
|
|
|
int r = uv_tcp_bind(&wrap->handle_, address); |
|
|
|
|
|
|
|
// Error starting the tcp.
|
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
|
|
|
|
return scope.Close(Integer::New(r)); |
|
|
|
} |
|
|
@ -247,7 +249,7 @@ Handle<Value> TCPWrap::Bind6(const Arguments& args) { |
|
|
|
int r = uv_tcp_bind6(&wrap->handle_, address); |
|
|
|
|
|
|
|
// Error starting the tcp.
|
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
|
|
|
|
return scope.Close(Integer::New(r)); |
|
|
|
} |
|
|
@ -263,7 +265,7 @@ Handle<Value> TCPWrap::Listen(const Arguments& args) { |
|
|
|
int r = uv_listen((uv_stream_t*)&wrap->handle_, backlog, OnConnection); |
|
|
|
|
|
|
|
// Error starting the tcp.
|
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
if (r) SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
|
|
|
|
return scope.Close(Integer::New(r)); |
|
|
|
} |
|
|
@ -298,7 +300,7 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) { |
|
|
|
// Successful accept. Call the onconnection callback in JavaScript land.
|
|
|
|
argv[0] = client_obj; |
|
|
|
} else { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
argv[0] = v8::Null(); |
|
|
|
} |
|
|
|
|
|
|
@ -317,7 +319,7 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) { |
|
|
|
assert(wrap->object_.IsEmpty() == false); |
|
|
|
|
|
|
|
if (status) { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
} |
|
|
|
|
|
|
|
Local<Value> argv[3] = { |
|
|
@ -353,7 +355,7 @@ Handle<Value> TCPWrap::Connect(const Arguments& args) { |
|
|
|
req_wrap->Dispatched(); |
|
|
|
|
|
|
|
if (r) { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
delete req_wrap; |
|
|
|
return scope.Close(v8::Null()); |
|
|
|
} else { |
|
|
@ -380,7 +382,7 @@ Handle<Value> TCPWrap::Connect6(const Arguments& args) { |
|
|
|
req_wrap->Dispatched(); |
|
|
|
|
|
|
|
if (r) { |
|
|
|
SetErrno(uv_last_error(uv_default_loop()).code); |
|
|
|
SetErrno(uv_last_error(uv_default_loop())); |
|
|
|
delete req_wrap; |
|
|
|
return scope.Close(v8::Null()); |
|
|
|
} else { |
|
|
|