From db6ba5b28ce6b10a64a06cf286e6de5de480688a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 23 Oct 2014 08:52:24 +0200 Subject: [PATCH] unix: remove overzealous assert in uv_read_stop Also make it a noop if we weren't reading at all. PR-URL: https://github.com/libuv/libuv/pull/47 Reviewed-By: Ben Noordhuis --- src/unix/stream.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index 94615dda..7d531fa9 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1471,15 +1471,8 @@ int uv_read_start(uv_stream_t* stream, int uv_read_stop(uv_stream_t* stream) { - /* Sanity check. We're going to stop the handle unless it's primed for - * writing but that means there should be some kind of write action in - * progress. - */ - assert(!uv__io_active(&stream->io_watcher, UV__POLLOUT) || - !QUEUE_EMPTY(&stream->write_completed_queue) || - !QUEUE_EMPTY(&stream->write_queue) || - stream->shutdown_req != NULL || - stream->connect_req != NULL); + if (!(stream->flags & UV_STREAM_READING)) + return 0; stream->flags &= ~UV_STREAM_READING; uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);