summaryrefslogtreecommitdiff
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-25 15:42:22 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-25 15:42:22 +0000
commit589da706be0b7abcbcf54e6f8c979c94ea174b09 (patch)
tree43da9a5cb9c4c690a2f02209979dd7f739c8980c /lib/rubygems/remote_fetcher.rb
parent7567977adc82ec528f4f0e5c650a940304e84b34 (diff)
* lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
[Backport #8682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/remote_fetcher.rb')
-rw-r--r--lib/rubygems/remote_fetcher.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index ec052b50da..86bad9de41 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -1,5 +1,6 @@
require 'rubygems'
require 'rubygems/user_interaction'
+require 'thread'
require 'uri'
require 'resolv'
@@ -72,6 +73,7 @@ class Gem::RemoteFetcher
Socket.do_not_reverse_lookup = true
@connections = {}
+ @connections_mutex = Mutex.new
@requests = Hash.new 0
@proxy_uri =
case proxy
@@ -391,8 +393,11 @@ class Gem::RemoteFetcher
end
connection_id = [Thread.current.object_id, *net_http_args].join ':'
- @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
- connection = @connections[connection_id]
+
+ connection = @connections_mutex.synchronize do
+ @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
+ @connections[connection_id]
+ end
if https?(uri) and not connection.started? then
configure_connection_for_https(connection)