Class: EventMachine::Protocols::TcpConnectTester
Constant Summary
Constants included
from Deferrable
Deferrable::Pool
Instance Attribute Summary
Attributes inherited from Connection
#signature
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Deferrable
#callback, #cancel_callback, #cancel_errback, #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_cipher_bits, #get_cipher_name, #get_cipher_protocol, #get_idle_time, #get_outbound_data_size, #get_peer_cert, #get_peername, #get_pid, #get_proxied_bytes, #get_sni_hostname, #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_completed, #proxy_incoming_to, #proxy_target_unbound, #receive_data, #reconnect, #resume, #send_data, #send_datagram, #send_file_data, #set_sock_opt, #ssl_handshake_completed, #ssl_verify_peer, #start_tls, #stop_proxying, #stream_file_data, #watch_only?
Class Method Details
.test(host, port) ⇒ Object
34
35
36
|
# File 'lib/em/protocols/tcptest.rb', line 34
def self.test( host, port )
EventMachine.connect( host, port, self )
end
|
Instance Method Details
#connection_completed ⇒ Object
42
43
44
45
46
|
# File 'lib/em/protocols/tcptest.rb', line 42
def connection_completed
@completed = true
set_deferred_status :succeeded, (Time.now - @start_time)
close_connection
end
|
#post_init ⇒ Object
38
39
40
|
# File 'lib/em/protocols/tcptest.rb', line 38
def post_init
@start_time = Time.now
end
|
#unbind ⇒ Object
48
49
50
|
# File 'lib/em/protocols/tcptest.rb', line 48
def unbind
set_deferred_status :failed, (Time.now - @start_time) unless @completed
end
|