Browse Source

stream_wrap: support empty `TryWrite`s

Decrement `vcount` in `DoTryWrite` even if some of the buffers are
empty.

PR-URL: https://github.com/nodejs/node/pull/3128
v4.x
Fedor Indutny 10 years ago
committed by Rod Vagg
parent
commit
1cc7b41ba4
  1. 2
      src/stream_wrap.cc

2
src/stream_wrap.cc

@ -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 // Slice off the buffers: skip all written buffers and slice the one that
// was partially written. // was partially written.
written = err; written = err;
for (; written != 0 && vcount > 0; vbufs++, vcount--) { for (; vcount > 0; vbufs++, vcount--) {
// Slice // Slice
if (vbufs[0].len > written) { if (vbufs[0].len > written) {
vbufs[0].base += written; vbufs[0].base += written;

Loading…
Cancel
Save