Method: Puppet::HTTP::Pool#borrow
- Defined in:
- lib/puppet/http/pool.rb
#borrow(site, verifier) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Borrow and take ownership of a persistent connection. If a new connection is created, it will be started prior to being returned.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/puppet/http/pool.rb', line 94 def borrow(site, verifier) @pool[site] = active_entries(site) index = @pool[site].index do |entry| (verifier.nil? && entry.verifier.nil?) || (!verifier.nil? && verifier.reusable?(entry.verifier)) end entry = index ? @pool[site].delete_at(index) : nil if entry @pool.delete(site) if @pool[site].empty? Puppet.debug("Using cached connection for #{site}") entry.connection else http = @factory.create_connection(site) start(site, verifier, http) setsockopts(http.instance_variable_get(:@socket)) http end end |