You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2021/03/25 10:03:58 UTC

[GitHub] [zookeeper] ztzg commented on a change in pull request #1651: ZOOKEEPER-4258: Improve stream use in QuorumCnxManager

ztzg commented on a change in pull request #1651:
URL: https://github.com/apache/zookeeper/pull/1651#discussion_r601294902



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
##########
@@ -1390,7 +1397,7 @@ public void run() {
                      * Allocates a new ByteBuffer to receive the message
                      */
                     final byte[] msgArray = new byte[length];
-                    din.readFully(msgArray, 0, length);
+                    din.read(msgArray);
                     addToRecvQueue(new Message(ByteBuffer.wrap(msgArray), sid));

Review comment:
       Did you mean `din.readFully(msgArray)`?  A bare `read` only "reads some number of bytes," and there is no guarantee we don't run into a fragmented packet or something else at this point, is there?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org