From b21f73fc424e1a2c3492f7b468dfc5dbd3b7ae7d Mon Sep 17 00:00:00 2001 From: kares Date: Sun, 3 Jul 2022 17:32:02 +0200 Subject: [PATCH] [refactor] a note on renegotiation_callback being incorrect --- .../java/org/jruby/ext/openssl/SSLSocket.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/jruby/ext/openssl/SSLSocket.java b/src/main/java/org/jruby/ext/openssl/SSLSocket.java index dd5cfe1d..cd1bc864 100644 --- a/src/main/java/org/jruby/ext/openssl/SSLSocket.java +++ b/src/main/java/org/jruby/ext/openssl/SSLSocket.java @@ -663,17 +663,14 @@ private void finishInitialHandshake() { session.putValue(SESSION_SOCKET_ID, getObjectId()); } } - + + // NOTE: gets called on negotiation connect/accept - not really on RE-negotiation as intended?! private void callRenegotiationCallback(final ThreadContext context) throws RaiseException { IRubyObject renegotiationCallback = sslContext.getInstanceVariable("@renegotiation_cb"); - if(renegotiationCallback == null || renegotiationCallback.isNil()) { - return; - } - else { - // the return of the Proc is not important - // Can throw ruby exception to "disallow" renegotiations - renegotiationCallback.callMethod(context, "call", this); - } + if (renegotiationCallback == null || renegotiationCallback.isNil()) return; + // the return of the Proc is not important + // Can throw ruby exception to "disallow" re-negotiations + renegotiationCallback.callMethod(context, "call", this); } public int write(ByteBuffer src, boolean blocking) throws SSLException, IOException {