Sha256: 0b47ff6ec0af9d78ade7467baa9abcf9c8dfaab43fe70bb40323c0b92f67609c

Contents?: true

Size: 604 Bytes

Versions: 32

Compression:

Stored size: 604 Bytes

Contents

module RestFtpDaemon
  class Launcher
    # Class constants
    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

32 entries across 32 versions & 1 rubygems

Version Path
rest-ftp-daemon-0.435.2 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.435.1 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.435.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.434.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.433.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.432.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.430.1 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.430.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.424.3 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.424.2 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.424.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.423.3 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.423.2 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.423.1 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.423.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.422.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.421.1 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.421.0 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.420.2 lib/rest-ftp-daemon/launcher.rb
rest-ftp-daemon-0.420.1 lib/rest-ftp-daemon/launcher.rb