Skip to content

Commit dd4a666

Browse files
committed
small internal argument polishing
1 parent c90d284 commit dd4a666

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/main/java/org/jruby/ext/openssl/SSLSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject arg
8282
final Ruby runtime = context.runtime;
8383

8484
if ( arg instanceof SSLSocket ) {
85-
return initializeImpl(context, (SSLSocket) arg);
85+
return initializeImpl((SSLSocket) arg);
8686
}
8787

8888
throw runtime.newNotImplementedError("Session#initialize with " + arg.getMetaClass().getName());
8989
}
9090

91-
SSLSession initializeImpl(final ThreadContext context, final SSLSocket socket) {
91+
SSLSession initializeImpl(final SSLSocket socket) {
9292
sslSession = socket.sslSession();
9393
return this;
9494
}

src/main/java/org/jruby/ext/openssl/SSLSocket.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,12 +1046,12 @@ final javax.net.ssl.SSLSession sslSession() {
10461046
@JRubyMethod(name = "session")
10471047
public IRubyObject session(final ThreadContext context) {
10481048
if ( sslSession() == null ) return context.nil;
1049-
return getSession(context);
1049+
return getSession(context.runtime);
10501050
}
10511051

1052-
private SSLSession getSession(final ThreadContext context) {
1052+
private SSLSession getSession(final Ruby runtime) {
10531053
if ( session == null ) {
1054-
return session = new SSLSession(context.runtime).initializeImpl(context, this);
1054+
return session = new SSLSession(runtime).initializeImpl(this);
10551055
}
10561056
return session;
10571057
}
@@ -1060,24 +1060,23 @@ private SSLSession getSession(final ThreadContext context) {
10601060

10611061
@JRubyMethod(name = "session=")
10621062
public IRubyObject set_session(IRubyObject session) {
1063-
final ThreadContext context = getRuntime().getCurrentContext();
10641063
// NOTE: we can not fully support this without the SSL provider internals
10651064
// but we can assume setting a session= is meant as a forced session re-use
10661065
if ( session instanceof SSLSession ) {
10671066
setSession = (SSLSession) session;
10681067
if ( engine != null ) copySessionSetupIfSet();
10691068
}
10701069
//warn(context, "WARNING: SSLSocket#session= has not effect");
1071-
return context.nil;
1070+
return getRuntime().getNil();
10721071
}
10731072

10741073
private void copySessionSetupIfSet() {
10751074
if ( setSession != null ) {
10761075
if ( reusableSSLEngine() ) {
10771076
engine.setEnableSessionCreation(false);
10781077
final ThreadContext context = getRuntime().getCurrentContext();
1079-
if ( ! setSession.equals( getSession(context) ) ) {
1080-
getSession(context).set_timeout(context, setSession.timeout(context));
1078+
if ( ! setSession.equals( getSession(context.runtime) ) ) {
1079+
getSession(context.runtime).set_timeout(context, setSession.timeout(context));
10811080
}
10821081
}
10831082
}

0 commit comments

Comments
 (0)