568: def eventable_write
569:
570: @last_activity = Reactor.instance.current_loop_time
571: while data = @outbound_q.shift do
572: begin
573: data = data.to_s
574: w = if io.respond_to?(:write_nonblock)
575: io.write_nonblock data
576: else
577: io.syswrite data
578: end
579:
580: if w < data.length
581: @outbound_q.unshift data[w..-1]
582: break
583: end
584: rescue Errno::EAGAIN
585: @outbound_q.unshift data
586: rescue EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED
587: @close_scheduled = true
588: @outbound_q.clear
589: end
590: end
591:
592: end