unix: fix stream refcounting buglet
Fix a buglet where uv_read_stop() would mark the handle as stopped even when there are in-progress write requests. This bug is unlikely to have affected anyone, the only case where it has a user-visible effect is when: a) the handle has been stopped for reading but not writing, and b) it's the last active handle in the event loop's pollset If both conditions are met, it's possible for the event loop to terminate prematurely.
This commit is contained in:
parent
c5d570ddba
commit
80f2f826bf
@ -1307,9 +1307,10 @@ int uv_read2_start(uv_stream_t* stream, uv_alloc_cb alloc_cb,
|
||||
|
||||
|
||||
int uv_read_stop(uv_stream_t* stream) {
|
||||
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
|
||||
uv__handle_stop(stream);
|
||||
stream->flags &= ~UV_STREAM_READING;
|
||||
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
|
||||
if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
|
||||
uv__handle_stop(stream);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* Notify select() thread about state change */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user