From c5e4c2294ebbe446cdfa1af1f63ebb7319190776 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 7 May 2014 07:13:39 +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);