Sha256: e7cd920c40076afd28986809e45fafdc4e6c4cf219947899ff9467ce3a45d21f
Contents?: true
Size: 582 Bytes
Versions: 7
Compression:
Stored size: 582 Bytes
Contents
module RestFtpDaemon class Launcher LAUNCHER_PORT_TIMEOUT = 3 LAUNCHER_PORT_LOCALHOST = "127.0.0.1" class << self def local_port_used? port Timeout.timeout(LAUNCHER_PORT_TIMEOUT) do begin TCPSocket.new(LAUNCHER_PORT_LOCALHOST, port).close true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH false rescue Errno::EADDRNOTAVAIL "local_port_used: Errno::EADDRNOTAVAIL" end end rescue Timeout::Error false end end end end
Version data entries
7 entries across 7 versions & 1 rubygems