From f44e42465516da186e8eb2ff273253ee7c8ac48f Mon Sep 17 00:00:00 2001 From: stroller Date: Sun, 15 Sep 2019 14:05:21 +0800 Subject: [PATCH] Remove duplicated calculation (#9565) Motivation: calculateMaxBytesPerGatheringWrite() contains duplicated calculation: getSendBufferSize() << 1 Modifications: Remove the duplicated calculation Result: The method will be clear and better --- .../main/java/io/netty/channel/socket/nio/NioSocketChannel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java index de5c374acc..f654bcf22f 100644 --- a/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java @@ -484,7 +484,7 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty // Multiply by 2 to give some extra space in case the OS can process write data faster than we can provide. int newSendBufferSize = getSendBufferSize() << 1; if (newSendBufferSize > 0) { - setMaxBytesPerGatheringWrite(getSendBufferSize() << 1); + setMaxBytesPerGatheringWrite(newSendBufferSize); } }