From 68083920a40fbccb8c3ce016c0ee9af5b2d19001 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 7 May 2014 07:08:36 +0200 Subject: [PATCH] [#2469] Correctly update indices after incomplete gathering write Motivation: When doing a gathering write we need to update the indices after the write partial completes. In the current code-base we use the wrong value when compare the expected written bytes and the actual written bytes. Modifications: Use the correct value when compare. Result: Indices are updated correctly and so no corruption can happen when resume writing after data was only partial written before. --- .../main/java/io/netty/channel/epoll/EpollSocketChannel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java index 7ff6c2bac1..2dda84aafd 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java @@ -171,7 +171,7 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So NioSocketChannelOutboundBuffer in, int msgCount, ByteBuffer[] nioBuffers) throws IOException { int nioBufferCnt = in.nioBufferCount(); - long expectedWrittenBytes = in.nioBufferCount(); + long expectedWrittenBytes = in.nioBufferSize(); long localWrittenBytes = Native.writev(fd, nioBuffers, 0, nioBufferCnt);