runzhiwang commented on a change in pull request #224:
URL: https://github.com/apache/incubator-ratis/pull/224#discussion_r505103978



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -79,31 +78,34 @@ public NettyServerStreamRpc(RaftPeer server, StateMachine 
stateMachine) {
     }
   }
 
-  private void writeTo(ByteBuf buf, DataStream stream, boolean released) {
+  private long writeTo(ByteBuf buf, DataStream stream, boolean released) {
     if (released) {
-      return;
+      return 0;
     }
     try {
       if (stream == null) {
-        return;
+        return 0;
       }
 
       final WritableByteChannel channel = stream.getWritableByteChannel();
+      long written = 0;
       for (ByteBuffer buffer : buf.nioBuffers()) {
         try {
-          channel.write(buffer);
+          written += channel.write(buffer);
         } catch (Throwable t) {
           throw new CompletionException(t);
         }
       }
+      return written;
     } finally {
       buf.release();
     }
   }
 
-  private void sendReply(DataStreamRequestByteBuf request, 
ChannelHandlerContext ctx) {
-    final DataStreamReply reply = new DataStreamReplyByteBuffer(
-        request.getStreamId(), request.getDataOffset(), 
ByteBuffer.wrap("OK".getBytes()));
+  private void sendReply(DataStreamRequestByteBuf request, long written, 
ChannelHandlerContext ctx) {
+    final boolean success = request.getDataLength() == written;

Review comment:
       `success ` seems useless.




----------------------------------------------------------------
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:
[email protected]


Reply via email to