unix: remove erroneous asserts

As of commit c53fe81, it's legal for write_queue_size > 0 when the
write_queue itself is empty. Sounds illogical but it means there are
error-state write requests in the write_completed_queue that will touch
up the write_queue_size on the next tick of the event loop.

Remove a few stray asserts that still checked for the old situation.
This commit is contained in:
Ben Noordhuis 2013-05-25 02:36:45 +02:00
parent 636a13b8c4
commit b38c9c1004

View File

@ -632,8 +632,6 @@ static void uv__drain(uv_stream_t* stream) {
uv_shutdown_t* req;
assert(ngx_queue_empty(&stream->write_queue));
assert(stream->write_queue_size == 0);
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
/* Shutdown? */
@ -727,10 +725,8 @@ start:
assert(uv__stream_fd(stream) >= 0);
if (ngx_queue_empty(&stream->write_queue)) {
assert(stream->write_queue_size == 0);
if (ngx_queue_empty(&stream->write_queue))
return;
}
q = ngx_queue_head(&stream->write_queue);
req = ngx_queue_data(q, uv_write_t, queue);
@ -1205,6 +1201,12 @@ int uv_write2(uv_write_t* req,
return uv__set_artificial_error(stream->loop, UV_EBADF);
}
/* It's legal for write_queue_size > 0 even when the write_queue is empty;
* it means there are error-state requests in the write_completed_queue that
* will touch up write_queue_size later, see also uv__write_req_finish().
* We chould check that write_queue is empty instead but that implies making
* a write() syscall when we know that the handle is in error mode.
*/
empty_queue = (stream->write_queue_size == 0);
/* Initialize the req */