szetszwo commented on code in PR #1179:
URL: https://github.com/apache/ratis/pull/1179#discussion_r1864746204


##########
ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java:
##########
@@ -459,7 +461,11 @@ private void readImpl(DataStreamRequestByteBuf request, 
ChannelHandlerContext ct
       localWrite = CompletableFuture.completedFuture(0L);
       remoteWrites = Collections.emptyList();
     } else if (request.getType() == Type.STREAM_DATA) {
-      localWrite = info.getLocal().write(request.slice(), 
request.getWriteOptionList(), writeExecutor);
+      if (close && request.getDataLength() == 0) {
+        localWrite = CompletableFuture.completedFuture(0L);
+      } else {
+        localWrite = info.getLocal().write(request.slice(), 
request.getWriteOptionList(), writeExecutor);
+      }

Review Comment:
   For length check, do you mean the new code?
   ```java
   if (buffer.remaining() == 0) {
      continue;
   }
   ```
   It is just a minor improvement.  The value `buffer.remaining()` is likely 
non-zero for most cases.  I am fine if we don't want to add it.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to