fixup! fixup! fixup! fixup! win: track each write_req in a queue instead of just a count

This commit is contained in:
Jameson Nash 2026-03-14 20:28:03 -04:00
parent ad88595061
commit 24e3cdd4d3
5 changed files with 5 additions and 7 deletions

View File

@ -95,7 +95,7 @@ enum {
UV_HANDLE_WRITABLE = 0x00008000,
UV_HANDLE_READ_PENDING = 0x00010000,
UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000,
UV_STREAM_IN_WRITE_CB = 0x00040000,
UV_HANDLE_IN_WRITE_CB = 0x00040000,
UV_HANDLE_EMULATE_IOCP = 0x00080000,
UV_HANDLE_BLOCKING_WRITES = 0x00100000,
UV_HANDLE_CANCELLATION_PENDING = 0x00200000,

View File

@ -155,7 +155,9 @@ INLINE static void uv__process_reqs(uv_loop_t* loop) {
break;
case UV_WRITE:
((uv_write_t*) req)->handle->flags |= UV_HANDLE_IN_WRITE_CB;
DELEGATE_STREAM_REQ(loop, (uv_write_t*) req, write, handle);
((uv_write_t*) req)->handle->flags &= ~UV_HANDLE_IN_WRITE_CB;
break;
case UV_ACCEPT:

View File

@ -218,7 +218,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
handle->reqs_pending++;
REGISTER_HANDLE_REQ(loop, handle);
if (!(handle->flags & UV_STREAM_IN_WRITE_CB) &&
if (!(handle->flags & UV_HANDLE_IN_WRITE_CB) &&
uv__queue_empty(&handle->stream.conn.write_queue)) {
if (handle->type == UV_NAMED_PIPE)
uv__pipe_shutdown(loop, (uv_pipe_t*) handle, req);

View File

@ -1103,9 +1103,7 @@ void uv__process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
/* use UV_ECANCELED for consistency with Unix */
err = UV_ECANCELED;
}
handle->flags |= UV_STREAM_IN_WRITE_CB;
req->cb(req, err);
handle->flags &= ~UV_STREAM_IN_WRITE_CB;
}
if (uv__queue_empty(&handle->stream.conn.write_queue)) {

View File

@ -136,9 +136,7 @@ static void after_read(uv_stream_t* handle,
ASSERT_NOT_NULL(wr);
wr->buf = uv_buf_init(buf->base, nread);
if (uv_write(&wr->req, handle, &wr->buf, 1, after_write)) {
FATAL("uv_write failed");
}
ASSERT_OK(uv_write(&wr->req, handle, &wr->buf, 1, after_write));
if (shutdown)
ASSERT_OK(uv_shutdown(malloc(sizeof* sreq), handle, on_shutdown));