Class: EventMachine::Protocols::TcpConnectTester

Inherits:
Connection
  • Object
show all
Includes:
Deferrable
Defined in:
lib/em/protocols/tcptest.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Connection

#signature

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Deferrable

#callback, #cancel_timeout, #errback, #fail, future, #set_deferred_status, #succeed, #timeout

Methods inherited from Connection

#associate_callback_target, #close_connection, #close_connection_after_writing, #comm_inactivity_timeout, #comm_inactivity_timeout=, #detach, #error?, #get_outbound_data_size, #get_peer_cert, #get_peername, #get_pid, #get_sock_opt, #get_sockname, #get_status, #initialize, new, #notify_readable=, #notify_readable?, #notify_writable=, #notify_writable?, #pause, #paused?, #pending_connect_timeout, #pending_connect_timeout=, #proxy_incoming_to, #proxy_target_unbound, #receive_data, #reconnect, #resume, #send_data, #send_datagram, #send_file_data, #set_comm_inactivity_timeout, #set_pending_connect_timeout, #ssl_handshake_completed, #ssl_verify_peer, #start_tls, #stop_proxying, #stream_file_data

Constructor Details

This class inherits a constructor from EventMachine::Connection

Class Method Details

.test(host, port) ⇒ Object



33
34
35
# File 'lib/em/protocols/tcptest.rb', line 33

def self.test( host, port )
  EventMachine.connect( host, port, self )
end

Instance Method Details

#connection_completedObject



41
42
43
44
45
# File 'lib/em/protocols/tcptest.rb', line 41

def connection_completed
  @completed = true
  set_deferred_status :succeeded, (Time.now - @start_time)
  close_connection
end

#post_initObject



37
38
39
# File 'lib/em/protocols/tcptest.rb', line 37

def post_init
  @start_time = Time.now
end

#unbindObject



47
48
49
# File 'lib/em/protocols/tcptest.rb', line 47

def unbind
  set_deferred_status :failed, (Time.now - @start_time)  unless @completed
end