Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: remove failed write requests from stream->write_queue_size
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis authored and ry committed Sep 16, 2011
1 parent 3c0684e commit 75a088e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/unix/stream.c
Expand Up @@ -287,6 +287,17 @@ static void uv__drain(uv_stream_t* stream) {
}


static size_t uv__write_req_size(uv_write_t* req) {
size_t size;

size = uv__buf_count(req->bufs + req->write_index,
req->bufcnt - req->write_index);
assert(req->handle->write_queue_size >= size);

return size;
}


static void uv__write_req_finish(uv_write_t* req) {
uv_stream_t* stream = req->handle;

Expand Down Expand Up @@ -351,6 +362,7 @@ static void uv__write(uv_stream_t* stream) {
if (errno != EAGAIN) {
/* Error */
req->error = errno;
stream->write_queue_size -= uv__write_req_size(req);
uv__write_req_finish(req);
return;
}
Expand Down

0 comments on commit 75a088e

Please sign in to comment.