@@ -1046,12 +1046,12 @@ final javax.net.ssl.SSLSession sslSession() {
1046
1046
@ JRubyMethod (name = "session" )
1047
1047
public IRubyObject session (final ThreadContext context ) {
1048
1048
if ( sslSession () == null ) return context .nil ;
1049
- return getSession (context );
1049
+ return getSession (context . runtime );
1050
1050
}
1051
1051
1052
- private SSLSession getSession (final ThreadContext context ) {
1052
+ private SSLSession getSession (final Ruby runtime ) {
1053
1053
if ( session == null ) {
1054
- return session = new SSLSession (context . runtime ).initializeImpl (context , this );
1054
+ return session = new SSLSession (runtime ).initializeImpl (this );
1055
1055
}
1056
1056
return session ;
1057
1057
}
@@ -1060,24 +1060,23 @@ private SSLSession getSession(final ThreadContext context) {
1060
1060
1061
1061
@ JRubyMethod (name = "session=" )
1062
1062
public IRubyObject set_session (IRubyObject session ) {
1063
- final ThreadContext context = getRuntime ().getCurrentContext ();
1064
1063
// NOTE: we can not fully support this without the SSL provider internals
1065
1064
// but we can assume setting a session= is meant as a forced session re-use
1066
1065
if ( session instanceof SSLSession ) {
1067
1066
setSession = (SSLSession ) session ;
1068
1067
if ( engine != null ) copySessionSetupIfSet ();
1069
1068
}
1070
1069
//warn(context, "WARNING: SSLSocket#session= has not effect");
1071
- return context . nil ;
1070
+ return getRuntime (). getNil () ;
1072
1071
}
1073
1072
1074
1073
private void copySessionSetupIfSet () {
1075
1074
if ( setSession != null ) {
1076
1075
if ( reusableSSLEngine () ) {
1077
1076
engine .setEnableSessionCreation (false );
1078
1077
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 ));
1081
1080
}
1082
1081
}
1083
1082
}
0 commit comments