71: def stream_one_chunk
72: loop {
73: if @position < @size
74: if @connection.get_outbound_data_size > BackpressureLevel
75: EventMachine::next_tick {stream_one_chunk}
76: break
77: else
78: len = @size - @position
79: len = ChunkSize if (len > ChunkSize)
80:
81: @connection.send_data( "#{len.to_s(16)}\r\n" ) if @http_chunks
82: @connection.send_data( @mapping.get_chunk( @position, len ))
83: @connection.send_data("\r\n") if @http_chunks
84:
85: @position += len
86: end
87: else
88: @connection.send_data "0\r\n\r\n" if @http_chunks
89: @mapping.close
90: succeed
91: break
92: end
93: }
94: end