class EventMachine::Connection
Public Class Methods
new(*args)
click to toggle source
# File lib/cool.io/eventmachine.rb, line 186 def self.new(*args) allocate#.instance_eval do # initialize *args #end end
Public Instance Methods
close_connection(after_writing = false)
click to toggle source
Close the connection, optionally after writing
# File lib/cool.io/eventmachine.rb, line 216 def close_connection(after_writing = false) return close_connection_after_writing if after_writing @wrapped_coolio.close end
close_connection_after_writing()
click to toggle source
Close the connection after all data has been written
# File lib/cool.io/eventmachine.rb, line 222 def close_connection_after_writing @wrapped_coolio.output_buffer_size.zero? ? @wrapped_coolio.close : @wrapped_coolio.should_close_after_writing end
get_peername()
click to toggle source
# File lib/cool.io/eventmachine.rb, line 226 def get_peername family, port, host_name, host_ip = @wrapped_coolio.peeraddr Socket.pack_sockaddr_in(port, host_ip) # pack it up :) end
heres_your_socket(instantiated_coolio_socket)
click to toggle source
Callback fired when data is received def receive_data(data); end
# File lib/cool.io/eventmachine.rb, line 205 def heres_your_socket(instantiated_coolio_socket) instantiated_coolio_socket.call_back_to_this self @wrapped_coolio = instantiated_coolio_socket end
post_init()
click to toggle source
we will need to call 'their functions' appropriately – the commented out ones, here
Callback fired when connection is created
# File lib/cool.io/eventmachine.rb, line 195 def post_init # I thought we were 'overriding' EM's existing methods, here. # Huh? Why do we have to define these then? end
send_data(data)
click to toggle source
Send data to the current connection – called by them
# File lib/cool.io/eventmachine.rb, line 211 def send_data(data) @wrapped_coolio.write data end
unbind()
click to toggle source
Callback fired when connection is closed
# File lib/cool.io/eventmachine.rb, line 201 def unbind; end