(maint) Update to jruby-9.4.1.0 and move socket timeout to new method.

This commit is contained in:
isaac-hammes 2023-03-02 12:02:42 -08:00
parent e8c3e2f8ba
commit cbec1d9d3a
5 changed files with 31 additions and 35 deletions

View file

@ -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