Class: EventMachine::StreamObject
- Inherits:
-
Selectable
- Object
- Selectable
- EventMachine::StreamObject
- Defined in:
- lib/style/handler/eventmachine.rb
Instance Method Summary collapse
-
#eventable_write ⇒ Object
Delete this when EventMachine fixes typo bug (Rubyforge bug #17461), see rubyforge.org/tracker/index.php?func=detail&aid=17461&group_id=1555&atid=6060.
Instance Method Details
#eventable_write ⇒ Object
Delete this when EventMachine fixes typo bug (Rubyforge bug #17461), see rubyforge.org/tracker/index.php?func=detail&aid=17461&group_id=1555&atid=6060
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/style/handler/eventmachine.rb', line 9 def eventable_write # coalesce the outbound array here, perhaps @last_activity = Reactor.instance.current_loop_time while data = @outbound_q.shift do begin data = data.to_s w = if io.respond_to?(:write_nonblock) io.write_nonblock data else io.syswrite data end if w < data.length @outbound_q.unshift data[w..-1] break end rescue Errno::EAGAIN @outbound_q.unshift data rescue EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED @close_scheduled = true @outbound_q.clear end end end |