stream_wrap: support empty `TryWrite`s
authorFedor Indutny <fedor@indutny.com>
Sat, 3 Oct 2015 20:15:15 +0000 (16:15 -0400)
committerRod Vagg <rod@vagg.org>
Mon, 5 Oct 2015 11:33:41 +0000 (22:33 +1100)
Decrement `vcount` in `DoTryWrite` even if some of the buffers are
empty.

PR-URL: https://github.com/nodejs/node/pull/3128

src/stream_wrap.cc

index 120e2c4..e6236a6 100644 (file)
@@ -313,7 +313,7 @@ int StreamWrap::DoTryWrite(uv_buf_t** bufs, size_t* count) {
   // Slice off the buffers: skip all written buffers and slice the one that
   // was partially written.
   written = err;
-  for (; written != 0 && vcount > 0; vbufs++, vcount--) {
+  for (; vcount > 0; vbufs++, vcount--) {
     // Slice
     if (vbufs[0].len > written) {
       vbufs[0].base += written;