fixup! fixup! fixup! win: track each write_req in a queue instead of just a count
This commit is contained in:
parent
b3ad00653c
commit
ad88595061
@ -95,7 +95,7 @@ enum {
|
||||
UV_HANDLE_WRITABLE = 0x00008000,
|
||||
UV_HANDLE_READ_PENDING = 0x00010000,
|
||||
UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000,
|
||||
/*UV_HANDLE_FLAG_UNUSED = 0x00040000,*/
|
||||
UV_STREAM_IN_WRITE_CB = 0x00040000,
|
||||
UV_HANDLE_EMULATE_IOCP = 0x00080000,
|
||||
UV_HANDLE_BLOCKING_WRITES = 0x00100000,
|
||||
UV_HANDLE_CANCELLATION_PENDING = 0x00200000,
|
||||
|
||||
@ -218,7 +218,8 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
|
||||
handle->reqs_pending++;
|
||||
REGISTER_HANDLE_REQ(loop, handle);
|
||||
|
||||
if (uv__queue_empty(&handle->stream.conn.write_queue)) {
|
||||
if (!(handle->flags & UV_STREAM_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);
|
||||
else
|
||||
|
||||
@ -1077,7 +1077,6 @@ void uv__process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
|
||||
void uv__process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
uv_write_t* req) {
|
||||
//uv_shutdown_t* shutdown_req;
|
||||
int err;
|
||||
|
||||
assert(handle->type == UV_TCP);
|
||||
@ -1104,7 +1103,9 @@ 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)) {
|
||||
@ -1112,23 +1113,10 @@ void uv__process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
closesocket(handle->socket);
|
||||
handle->socket = INVALID_SOCKET;
|
||||
}
|
||||
// if (uv__is_stream_shutting(handle)) {
|
||||
// shutdown_req = handle->stream.conn.shutdown_req;
|
||||
// if (shutdown_req->next_req == (uv_req_t*)shutdown_req) {
|
||||
// assert(loop->pending_reqs_tail == (uv_req_t*)shutdown_req);
|
||||
// loop->pending_reqs_tail = NULL;
|
||||
// } else {
|
||||
// uv_req_t** pending;
|
||||
// pending = &loop->pending_reqs_tail;
|
||||
// while ((*pending)->next_req != (uv_req_t*)shutdown_req) {
|
||||
// pending = &(*pending)->next_req;
|
||||
// assert(*pending != loop->pending_reqs_tail);
|
||||
// }
|
||||
// *pending = shutdown_req->next_req;
|
||||
// }
|
||||
// shutdown_req->next_req = NULL;
|
||||
// uv__process_tcp_shutdown_req(loop, handle, shutdown_req);
|
||||
// }
|
||||
if (uv__is_stream_shutting(handle))
|
||||
uv__process_tcp_shutdown_req(loop,
|
||||
handle,
|
||||
handle->stream.conn.shutdown_req);
|
||||
}
|
||||
|
||||
DECREASE_PENDING_REQ_COUNT(handle);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user