amaliujia commented on a change in pull request #272:
URL: https://github.com/apache/incubator-ratis/pull/272#discussion_r521878561
##########
File path:
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -326,8 +327,11 @@ private StreamInfo newStreamInfo(ByteBuf buf) {
}
static long writeTo(ByteBuf buf, DataStream stream) {
- final WritableByteChannel channel = stream.getWritableByteChannel();
long byteWritten = 0;
+ if (stream == null) {
Review comment:
Yeah that what I was thinking in
https://issues.apache.org/jira/browse/RATIS-1130?focusedCommentId=17228841&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17228841
Sure I can move `MultiDataStreamStateMachine` to make it reusable. Do you
prefer I do that in another PR (as this PR is pretty large now) or just add
that refactoring in this PR?
Also adding a `NULL` check is still useful. I found that without this NULL
check, this code will hit a NPE and the program will hang there. If don't add
this NULL check, then at least we should check the NPE and solve why program
will hang.
----------------------------------------------------------------
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]