[前][次][番号順一覧][スレッド一覧]

ruby-changes:43919

From: nobu <ko1@a...>
Date: Tue, 23 Aug 2016 11:05:29 +0900 (JST)
Subject: [ruby-changes:43919] nobu:r55992 (trunk): test_ssl_server.rb: fix FD leak

nobu	2016-08-23 11:05:24 +0900 (Tue, 23 Aug 2016)

  New Revision: 55992

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55992

  Log:
    test_ssl_server.rb: fix FD leak
    
    * test/webrick/test_ssl_server.rb (assert_self_signed_cert): close
      underlying TCP socket to fix FD leak.

  Modified files:
    trunk/test/webrick/test_ssl_server.rb
Index: test/webrick/test_ssl_server.rb
===================================================================
--- test/webrick/test_ssl_server.rb	(revision 55991)
+++ test/webrick/test_ssl_server.rb	(revision 55992)
@@ -28,11 +28,13 @@ class TestWEBrickSSLServer < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/webrick/test_ssl_server.rb#L28
 
   def assert_self_signed_cert(config)
     TestWEBrick.start_server(Echo, config){|server, addr, port, log|
-      sock = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(addr, port))
+      io = TCPSocket.new(addr, port)
+      sock = OpenSSL::SSL::SSLSocket.new(io)
       sock.connect
       sock.puts(server.ssl_context.cert.subject.to_s)
       assert_equal("/C=JP/O=www.ruby-lang.org/CN=Ruby\n", sock.gets, log.call)
       sock.close
+      io.close
     }
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]