mirror of
https://github.com/puppetlabs/vmpooler-provider-gce.git
synced 2026-01-26 03:18:41 -05:00
(maint) Update to jruby-9.4.1.0 and move socket timeout to new method.
This commit is contained in:
parent
e8c3e2f8ba
commit
cbec1d9d3a
5 changed files with 31 additions and 35 deletions
|
|
@ -683,15 +683,13 @@ module Vmpooler
|
|||
|
||||
# This should supercede the open_socket method in the Pool Manager
|
||||
def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)
|
||||
Timeout.timeout(timeout) do
|
||||
target_host = host
|
||||
target_host = "#{host}.#{domain}" if domain
|
||||
sock = TCPSocket.new target_host, port
|
||||
begin
|
||||
yield sock if block_given?
|
||||
ensure
|
||||
sock.close
|
||||
end
|
||||
target_host = host
|
||||
target_host = "#{host}.#{domain}" if domain
|
||||
sock = TCPSocket.new(target_host, port, connect_timeout: timeout)
|
||||
begin
|
||||
yield sock if block_given?
|
||||
ensure
|
||||
sock.close
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue