exceptionfactory commented on a change in pull request #5836:
URL: https://github.com/apache/nifi/pull/5836#discussion_r822838085
##########
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:
Thanks for the feedback, I can add a comment below mentioning that
writing the close notification to the socket channel is required after closing
the SSLEngine.
##########
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:
This change was just for variable reuse, but that seems like a
reasonable improvement.
--
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]