Public instance methods
eventable_write
()
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
[show source]
# File lib/style/handler/eventmachine.rb, line 9 9: def eventable_write 10: # coalesce the outbound array here, perhaps 11: @last_activity = Reactor.instance.current_loop_time 12: while data = @outbound_q.shift do 13: begin 14: data = data.to_s 15: w = if io.respond_to?(:write_nonblock) 16: io.write_nonblock data 17: else 18: io.syswrite data 19: end 20: 21: if w < data.length 22: @outbound_q.unshift data[w..-1] 23: break 24: end 25: rescue Errno::EAGAIN 26: @outbound_q.unshift data 27: rescue EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED 28: @close_scheduled = true 29: @outbound_q.clear 30: end 31: end 32: end