File tree Expand file tree Collapse file tree
main/java/org/jruby/ext/openssl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -883,12 +883,11 @@ private void forceClose() {
883883 close (true );
884884 }
885885
886- //private boolean closed;
887-
888886 private void close (boolean force ) {
889- //closed = true;
890-
891- if ( engine == null ) throw getRuntime ().newEOFError ();
887+ if ( engine == null ) {
888+ // if ( force ) throw getRuntime().newEOFError();
889+ return ;
890+ }
892891
893892 engine .closeOutbound ();
894893
@@ -903,8 +902,6 @@ private void close(boolean force) {
903902 }
904903 }
905904
906- //final boolean isClosed() { return closed; }
907-
908905 @ JRubyMethod
909906 public IRubyObject sysclose (final ThreadContext context ) {
910907 //if ( isClosed() ) return context.runtime.getNil();
Original file line number Diff line number Diff line change @@ -42,4 +42,16 @@ def test_attr_methods
4242 socket . inspect
4343 end
4444
45+ def test_sync_close_without_connect
46+ require 'socket'
47+ Socket . open ( :INET , :STREAM ) do |socket |
48+ assert ! socket . closed?
49+ ssl = OpenSSL ::SSL ::SSLSocket . new ( socket )
50+ ssl . sync_close = true
51+ assert ! ssl . closed?
52+ ssl . close
53+ assert socket . closed?
54+ end
55+ end
56+
4557end
You can’t perform that action at this time.
0 commit comments