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

ruby-changes:34861

From: nobu <ko1@a...>
Date: Fri, 25 Jul 2014 16:55:53 +0900 (JST)
Subject: [ruby-changes:34861] nobu:r46944 (trunk): remote_fetcher.rb: fix leaked FDs

nobu	2014-07-25 16:55:42 +0900 (Fri, 25 Jul 2014)

  New Revision: 46944

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

  Log:
    remote_fetcher.rb: fix leaked FDs
    
    * lib/rubygems/remote_fetcher.rb (request): close connections.
    
    * lib/rubygems/request.rb (close): ditto.

  Modified files:
    trunk/lib/rubygems/remote_fetcher.rb
    trunk/lib/rubygems/request.rb
Index: lib/rubygems/request.rb
===================================================================
--- lib/rubygems/request.rb	(revision 46943)
+++ lib/rubygems/request.rb	(revision 46944)
@@ -28,6 +28,12 @@ class Gem::Request https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request.rb#L28
     @env_no_proxy = get_no_proxy_from_env
   end
 
+  def close
+    @connections.each_value do |conn|
+      conn.finish
+    end
+  end
+
   def add_rubygems_trusted_certs(store)
     pattern = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
     Dir.glob(pattern).each do |ssl_cert_file|
Index: lib/rubygems/remote_fetcher.rb
===================================================================
--- lib/rubygems/remote_fetcher.rb	(revision 46943)
+++ lib/rubygems/remote_fetcher.rb	(revision 46944)
@@ -337,6 +337,8 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/remote_fetcher.rb#L337
     request.fetch do |req|
       yield req if block_given?
     end
+  ensure
+    request.close if request
   end
 
   def https?(uri)

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

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