greyp9 commented on a change in pull request #5836:
URL: https://github.com/apache/nifi/pull/5836#discussion_r822805247



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java
##########
@@ -79,9 +114,9 @@ public OptionalInt read() throws IOException {
         singleByteBuffer.clear();
         final int bytesRead = read(singleByteBuffer);
         if (bytesRead < 0) {
-             return OptionalInt.of(-1);
+             return OptionalInt.of(END_OF_FILE);
         }
-        if (bytesRead == 0) {
+        if (bytesRead == EMPTY_BUFFER) {

Review comment:
       Maybe a chained `else if` here?

##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java
##########
@@ -50,7 +55,37 @@ public PeerChannel(final SocketChannel socketChannel, final 
SSLEngine sslEngine,
 
     @Override
     public void close() throws IOException {
-        socketChannel.close();
+        try {
+            if (sslEngine == null) {
+                logger.debug("Closing Peer Channel [{}] SSLEngine not 
configured", peerDescription);
+            } else {
+                logger.debug("Closing Peer Channel [{}] SSLEngine close 
started", peerDescription);
+                sslEngine.closeOutbound();

Review comment:
       The write after the `closeOutbound()` is not intuitive.  Maybe a comment 
explaining the needed sequence of actions?




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