Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

tcp, pipe: don't assert on uv_accept() errors

It's possible for a new connection to be closed in the window between the
accept() syscall and the call to uv_accept(). Deal with it and move on, don't
assert.
  • Loading branch information...
bnoordhuis committed Feb 15, 2012
1 parent 14b20ff commit 0685707bc643250de297b59f4f58878d4c17292e
Showing with 2 additions and 8 deletions.
  1. +1 −4 src/pipe_wrap.cc
  2. +1 −4 src/tcp_wrap.cc
@@ -204,10 +204,7 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) {
PipeWrap* client_wrap =
static_cast<PipeWrap*>(client_obj->GetPointerFromInternalField(0));

int r = uv_accept(handle, (uv_stream_t*)&client_wrap->handle_);

// uv_accept should always work.
assert(r == 0);
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;

// Successful accept. Call the onconnection callback in JavaScript land.
Local<Value> argv[1] = { client_obj };
@@ -366,10 +366,7 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) {
TCPWrap* client_wrap =
static_cast<TCPWrap*>(client_obj->GetPointerFromInternalField(0));

int r = uv_accept(handle, (uv_stream_t*)&client_wrap->handle_);

// uv_accept should always work.
assert(r == 0);
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;

// Successful accept. Call the onconnection callback in JavaScript land.
argv[0] = client_obj;

0 comments on commit 0685707

Please sign in to comment.
You can’t perform that action at this time.