class EventMachine::StreamObject
def eventable_write
The last-activity recorder ASSUMES we'll only come here if we've
URGENT TODO: Coalesce small writes. They are a performance killer.
connections. Also we should coalesce small writes.
one busy connection could hog output buffers and slow down other
not more than a certain number of bytes per cycle, otherwise
We need to improve the loop so it writes multiple times, however
built from sources from May 25, 2006 or newer).
we're running on a Ruby with proper nonblocking I/O (Ruby 1.8.4
a single packet per cycle. Highly inefficient, but required unless
TODO: Complete this implementation. As it stands, this only writes
Provisional implementation. Will be re-implemented in subclasses.
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, SSLConnectionWaitReadable, SSLConnectionWaitWritable @outbound_q.unshift data break rescue EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EPIPE, OpenSSL::SSL::SSLError @close_scheduled = true @outbound_q.clear end end end