class EventMachine::CallsBackToEM
Public Class Methods
connect(*args)
click to toggle source
Calls superclass method
Coolio::TCPSocket.connect
# File lib/cool.io/eventmachine.rb, line 175 def self.connect(*args) a = super *args # the connect timer currently kills TCPServer classes. I'm not sure why. #@connection_timer = ConnectTimer.new(14) # needs to be at least higher than 12 :) #@connection_timer.parent = a #@connection_timer.attach(Coolio::Loop.default) a end
Public Instance Methods
call_back_to_this(parent)
click to toggle source
# File lib/cool.io/eventmachine.rb, line 123 def call_back_to_this parent @call_back_to_this = parent parent.post_init end
connection_has_timed_out()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 137 def connection_has_timed_out return if closed? # wonder if this works when you're within a half-connected phase. # I think it does. What about TCP state? close unless closed? @call_back_to_this.unbind end
fail()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 170 def fail #@connection_timer.detch if @connection_timer @call_back_to_this.unbind end
on_close()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 154 def on_close @call_back_to_this.unbind # about the same ltodo check if they ARE the same here end
on_connect()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 128 def on_connect # @connection_timer.detach if @connection_timer # won't need that anymore :) -- with server connecteds we don't have it, anyway # TODO should server accepted's call this? They don't currently # [and can't, since on_connect gets called basically in the initializer--needs some code love for that to happen :) @call_back_to_this.connection_completed if @call_back_to_this end
on_connect_failed()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 162 def on_connect_failed fail end
on_read(data)
click to toggle source
# File lib/cool.io/eventmachine.rb, line 166 def on_read(data) @call_back_to_this.receive_data data end
on_resolve_failed()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 158 def on_resolve_failed fail end
on_write_complete()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 146 def on_write_complete close if @should_close_after_writing end
should_close_after_writing()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 150 def should_close_after_writing @should_close_after_writing = true; end