From d3e7e3cc8b8d8e4a04ee15f68bb06e4844b52f42 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 23 Aug 2016 02:05:24 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/webrick/test_ssl_server.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/webrick/test_ssl_server.rb b/test/webrick/test_ssl_server.rb index 994fde7a1b..f6d5250365 100644 --- a/test/webrick/test_ssl_server.rb +++ b/test/webrick/test_ssl_server.rb @@ -28,11 +28,13 @@ class TestWEBrickSSLServer < Test::Unit::TestCase 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