szetszwo commented on a change in pull request #224:
URL: https://github.com/apache/incubator-ratis/pull/224#discussion_r505109763
##########
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:
Yes, it is not useful for now. I don't want to change to many code in
this issue. Just have filed https://issues.apache.org/jira/browse/RATIS-1098
as a followup.
----------------------------------------------------------------
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]