pivotal-jbarrett commented on a change in pull request #7449:
URL: https://github.com/apache/geode/pull/7449#discussion_r838921167



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
##########
@@ -381,19 +408,26 @@ public synchronized void close(SocketChannel 
socketChannel) {
     try (final ByteBufferSharing outputSharing = outputBufferVendor.open(1, 
TimeUnit.MINUTES)) {
       final ByteBuffer myNetData = outputSharing.getBuffer();
 
-      if (!engine.isOutboundDone()) {
-        ByteBuffer empty = ByteBuffer.wrap(new byte[0]);
-        engine.closeOutbound();
+      engine.closeOutbound();

Review comment:
       Smart to only invoke this once.

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
##########
@@ -381,19 +408,26 @@ public synchronized void close(SocketChannel 
socketChannel) {
     try (final ByteBufferSharing outputSharing = outputBufferVendor.open(1, 
TimeUnit.MINUTES)) {
       final ByteBuffer myNetData = outputSharing.getBuffer();
 
-      if (!engine.isOutboundDone()) {
-        ByteBuffer empty = ByteBuffer.wrap(new byte[0]);
-        engine.closeOutbound();
+      engine.closeOutbound();
+
+      SSLEngineResult result = null;
+
+      while (!engine.isOutboundDone()) {
+        final ByteBuffer empty = ByteBuffer.wrap(new byte[0]);
 
         // clear the buffer to receive a CLOSE message from the SSLEngine
         myNetData.clear();
 
         // Get close message
-        SSLEngineResult result = engine.wrap(empty, myNetData);
-
-        if (result.getStatus() != SSLEngineResult.Status.CLOSED) {
-          throw new SSLHandshakeException(
-              "Error closing SSL session.  Status=" + result.getStatus());
+        result = engine.wrap(empty, myNetData);

Review comment:
       Is it possible to get a `BUFFER_OVERFLOW` here?

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
##########
@@ -381,19 +408,26 @@ public synchronized void close(SocketChannel 
socketChannel) {
     try (final ByteBufferSharing outputSharing = outputBufferVendor.open(1, 
TimeUnit.MINUTES)) {
       final ByteBuffer myNetData = outputSharing.getBuffer();
 
-      if (!engine.isOutboundDone()) {
-        ByteBuffer empty = ByteBuffer.wrap(new byte[0]);
-        engine.closeOutbound();
+      engine.closeOutbound();
+
+      SSLEngineResult result = null;
+
+      while (!engine.isOutboundDone()) {
+        final ByteBuffer empty = ByteBuffer.wrap(new byte[0]);

Review comment:
       Can't this be a final member variable?




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