Skip to content

Commit 55380ec

Browse files
committed
[refactor] organize i-var sets (set @context after setup)
1 parent f9e7c18 commit 55380ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,26 +162,26 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
162162
final Ruby runtime = context.runtime;
163163

164164
if (Arity.checkArgumentCount(runtime, args, 1, 2) == 1) {
165-
sslContext = new SSLContext(runtime).initializeImpl();
165+
this.sslContext = new SSLContext(runtime).initializeImpl();
166166
} else {
167167
if (!(args[1] instanceof SSLContext)) {
168168
throw runtime.newTypeError(args[1], "OpenSSL::SSL::SSLContext");
169169
}
170-
sslContext = (SSLContext) args[1];
170+
this.sslContext = (SSLContext) args[1];
171171
}
172172

173173
if (!(args[0] instanceof RubyIO)) {
174174
throw runtime.newTypeError("IO expected but got " + args[0].getMetaClass().getName());
175175
}
176-
setInstanceVariable("@context", this.sslContext); // only compat (we do not use @context)
177-
setInstanceVariable("@io", this.io = (RubyIO) args[0]);
176+
setInstanceVariable("@io", this.io = (RubyIO) args[0]); // RubyBasicSocket extends RubyIO
178177
set_io_nonblock_checked(context, runtime.getTrue());
179178
// This is a bit of a hack: SSLSocket should share code with
180179
// RubyBasicSocket, which always sets sync to true.
181180
// Instead we set it here for now.
182181
set_sync(context, runtime.getTrue()); // io.sync = true
183182
setInstanceVariable("@sync_close", runtime.getFalse()); // self.sync_close = false
184183
sslContext.setup(context);
184+
setInstanceVariable("@context", sslContext); // only compat (we do not use @context)
185185

186186
this.initializeTime = System.currentTimeMillis();
187187

0 commit comments

Comments
 (0)