unix: unconditionally stop handle on close

Make sure the handle is fully stopped by the time uv__stream_close()
calls uv_read_stop(). Fixes the following assertion:

    Assertion failed: (!uv__io_active(&stream->io_watcher, UV__POLLOUT)
    || !ngx_queue_empty(&stream->write_completed_queue)
    || !ngx_queue_empty(&stream->write_queue)
    || stream->shutdown_req != NULL
    || stream->connect_req != NULL), function uv_read_stop,
    file ../deps/uv/src/unix/stream.c, line 1329.

Fixes joyent/node#5622.
This commit is contained in:
Ben Noordhuis 2013-06-05 15:01:34 +02:00
parent e9ae62d13a
commit 8e4b248ca6

View File

@ -1395,8 +1395,9 @@ void uv__stream_close(uv_stream_t* handle) {
}
#endif /* defined(__APPLE__) */
uv_read_stop(handle);
uv__io_close(handle->loop, &handle->io_watcher);
uv_read_stop(handle);
uv__handle_stop(handle);
close(handle->io_watcher.fd);
handle->io_watcher.fd = -1;