You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jo...@apache.org on 2022/01/15 14:11:11 UTC

[mina] branch 2.2.X updated: Adds CLOSURE toggle for SSL debugging

This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a commit to branch 2.2.X
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/2.2.X by this push:
     new 660ab23  Adds CLOSURE toggle for SSL debugging
660ab23 is described below

commit 660ab2375b4b47b5ebe86226c92f3138be4c96e8
Author: Jonathan Valliere <jo...@apache.org>
AuthorDate: Sat Jan 15 09:11:09 2022 -0500

    Adds CLOSURE toggle for SSL debugging
    
    * Adds ENABLE_SOFT_CLOSURE as a toggle
---
 .../java/org/apache/mina/filter/ssl/SSLHandlerG0.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java b/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java
index 648e0bb..bc60f1d 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java
@@ -55,6 +55,11 @@ public class SSLHandlerG0 extends SSLHandler {
 	static protected final int MAX_UNACK_MESSAGES = 6;
 
 	/**
+	 * Writes the SSL Closure messages after a close request
+	 */
+	static protected final boolean ENABLE_SOFT_CLOSURE = true;
+
+	/**
 	 * Enable aggregation of handshake messages
 	 */
 	static protected final boolean ENABLE_FAST_HANDSHAKE = true;
@@ -472,8 +477,7 @@ public class SSLHandlerG0 extends SSLHandler {
 		switch (result.getHandshakeStatus()) {
 			case NEED_UNWRAP:
 				if (LOGGER.isDebugEnabled()) {
-					LOGGER.debug("{} write_handshake_loop() - handshake needs unwrap, invoking receive",
-							toString());
+					LOGGER.debug("{} write_handshake_loop() - handshake needs unwrap, invoking receive", toString());
 				}
 				this.receive(next, ZERO);
 				break;
@@ -551,7 +555,9 @@ public class SSLHandlerG0 extends SSLHandler {
 
 		if (this.mOutboundClosing && this.mEncodeQueue.size() == 0) {
 			this.mEngine.closeOutbound();
-			this.write_handshake(next);
+			if (ENABLE_SOFT_CLOSURE) {
+				this.write_handshake(next);
+			}
 		}
 	}
 
@@ -580,7 +586,9 @@ public class SSLHandlerG0 extends SSLHandler {
 				this.mEncodeQueue.clear();
 			}
 			this.mEngine.closeOutbound();
-			this.write_handshake(next);
+			if (ENABLE_SOFT_CLOSURE) {
+				this.write_handshake(next);
+			}
 		} else {
 			this.flush(next);
 		}