From ce9171d41f15f4fa5f9e6752ff1186b5bf480c4c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 22 Aug 2011 19:28:45 -0700 Subject: [PATCH] unix: uv_read_start should fail if UV_CLOSING set --- src/uv-unix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/uv-unix.c b/src/uv-unix.c index 27227c98..767a6021 100644 --- a/src/uv-unix.c +++ b/src/uv-unix.c @@ -1255,6 +1255,11 @@ int64_t uv_now() { int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb) { assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE); + if (stream->flags & UV_CLOSING) { + uv_err_new((uv_handle_t*)stream, EINVAL); + return -1; + } + /* The UV_READING flag is irrelevant of the state of the tcp - it just * expresses the desired state of the user. */