Class | TCPSocket
In: | lib/tcp_socket_extension.rb
Parent: | Object

### Methods

listening_service? verbose_wait wait_for_service wait_for_service_termination

### Public Class methods

listening_service?(options)

[Source]

        # File lib/tcp_socket_extension.rb, line 14
    14:   def self.listening_service?(options)
    15:     Timeout::timeout(options[:timeout] || 20) do
    16:       begin
    17:         socket = TCPSocket.new(options[:host], options[:port])
    18:         socket.close unless socket.nil?
    19:         true
    20:       rescue Errno::ECONNREFUSED,
    21:              Errno::EBADF           # Windows
    22:         false
    23:       end
    24:     end
    25:   end

verbose_wait()

[Source]

        # File lib/tcp_socket_extension.rb, line 27
    27:   def self.verbose_wait
    28:     puts ".\n"
    29:     sleep 2
    30:   end

wait_for_service(options)

[Source]

       # File lib/tcp_socket_extension.rb, line 6
    6:   def self.wait_for_service(options)
    7:     verbose_wait until listening_service?(options)
    8:   end

wait_for_service_termination(options)

[Source]

        # File lib/tcp_socket_extension.rb, line 10
    10:   def self.wait_for_service_termination(options)
    11:     verbose_wait while listening_service?(options)
    12:   end

[Validate]