You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/03/09 16:16:02 UTC

[GitHub] [nifi] greyp9 commented on a change in pull request #5836: NIFI-9761 Correct PeerChannel processing for TLS 1.3

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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org