89: def stream_one_chunk
90: loop {
91: if @position < @size
92: if @connection.get_outbound_data_size > BackpressureLevel
93: EventMachine::next_tick {stream_one_chunk}
94: break
95: else
96: len = @size - @position
97: len = ChunkSize if (len > ChunkSize)
98:
99: @connection.send_data( "#{len.to_s(16)}\r\n" ) if @http_chunks
100: @connection.send_data( @mapping.get_chunk( @position, len ))
101: @connection.send_data("\r\n") if @http_chunks
102:
103: @position += len
104: end
105: else
106: @connection.send_data "0\r\n\r\n" if @http_chunks
107: @mapping.close
108: succeed
109: break
110: end
111: }
112: end