Navigation Menu

Skip to content

Commit

Permalink
Use LineBuffer to support chunk data
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 3, 2014
1 parent dcae56d commit b863505
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/droonga/command/droonga_engine.rb
Expand Up @@ -24,6 +24,7 @@
require "droonga/serf"
require "droonga/catalog_observer"
require "droonga/service_control_protocol"
require "droonga/line_buffer"

module Droonga
module Command
Expand Down Expand Up @@ -412,9 +413,9 @@ def attach_control_write_out(control_write_out)

def attach_control_read_in(control_read_in)
@control_read_in = Coolio::IO.new(control_read_in)
line_buffer = LineBuffer.new
on_read = lambda do |data|
# TODO: should buffer data to handle half line received case
data.each_line do |line|
line_buffer.feed(data) do |line|
case line
when Messages::READY
on_ready
Expand Down
5 changes: 3 additions & 2 deletions lib/droonga/command/droonga_engine_service.rb
Expand Up @@ -18,6 +18,7 @@
require "coolio"

require "droonga/service_control_protocol"
require "droonga/line_buffer"
require "droonga/engine"
require "droonga/fluent_message_receiver"
require "droonga/internal_fluent_message_receiver"
Expand Down Expand Up @@ -162,8 +163,8 @@ def run_control_io
@control_read = Coolio::IO.new(IO.new(@control_read_fd))
@control_read_fd = nil
on_read = lambda do |data|
# TODO: should buffer data to handle half line received case
data.each_line do |line|
line_buffer = LineBuffer.new
line_buffer.feed(data) do |line|
case line
when Messages::STOP_GRACEFUL
stop_gracefully
Expand Down

0 comments on commit b863505

Please sign in to comment.