From c7c00c6170670a670a597aff43dec6f8ff6be34a Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Wed, 19 Aug 2015 17:46:10 +0300
Subject: [PATCH] gh-983: another shot at

sio_move_iov is not built to advance both obuf_svp and iov,
tweak the code to make sure it does what's needed.
---
 src/box/iproto.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/box/iproto.cc b/src/box/iproto.cc
index 8e9b69490e..0cdb34e22f 100644
--- a/src/box/iproto.cc
+++ b/src/box/iproto.cc
@@ -577,10 +577,12 @@ iproto_flush(struct iobuf *iobuf, struct iproto_connection *con)
 			}
 			return 0;
 		}
-		size_t iov_len = 0;
+		size_t offset = 0;
+		int advance = 0;
+		advance = sio_move_iov(iov, nwr, &offset);
 		begin->used += nwr;             /* advance write position */
-		begin->pos += sio_move_iov(iov, nwr, &iov_len);
-		begin->iov_len = iov_len;
+		begin->iov_len = advance == 0 ? begin->iov_len + offset: offset;
+		begin->pos += advance;
 		assert(begin->pos <= end->pos);
 	}
 	return -1;
-- 
GitLab