Class: EventMachine::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/oversip/ruby_ext/eventmachine.rb

Instance Method Summary collapse

Instance Method Details

#_em_close_connectionObject

Rewrite close_connection so it set an internal attribute (which can be inspected when unbind() callback is called).



26
# File 'lib/oversip/ruby_ext/eventmachine.rb', line 26

alias _em_close_connection close_connection

#close_connection(after_writing = false) ⇒ Object



27
28
29
30
# File 'lib/oversip/ruby_ext/eventmachine.rb', line 27

def close_connection after_writing=false
  @local_closed = true
  _em_close_connection after_writing
end

#close_connection_after_writingObject



32
33
34
# File 'lib/oversip/ruby_ext/eventmachine.rb', line 32

def close_connection_after_writing
  close_connection true
end

#send_data(data) ⇒ Object

We require Ruby 1.9 so don’t check String#bytesize method.



16
17
18
# File 'lib/oversip/ruby_ext/eventmachine.rb', line 16

def send_data data
  ::EventMachine::send_data @signature, data, data.bytesize
end

#send_datagram(data, address, port) ⇒ Object



20
21
22
# File 'lib/oversip/ruby_ext/eventmachine.rb', line 20

def send_datagram data, address, port
  ::EventMachine::send_datagram @signature, data, data.bytesize, address, port
end