THRIFT-604: rb: nonblocking_server assumes that socket.read returns exactly one message
authorBryan Duxbury <bryanduxbury@apache.org>
Fri, 15 Jan 2010 17:30:40 +0000 (17:30 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Fri, 15 Jan 2010 17:30:40 +0000 (17:30 +0000)
This patch causes every message currently in the buffer to be processed before going on.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@899725 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/lib/thrift/server/nonblocking_server.rb

index 5425f6d..9e1cfe6 100644 (file)
@@ -160,8 +160,7 @@ module Thrift
 
       def read_connection(fd)
         @buffers[fd] << fd.read(DEFAULT_BUFFER)
-        frame = slice_frame!(@buffers[fd])
-        if frame
+        while(frame = slice_frame!(@buffers[fd]))
           @logger.debug "#{self} is processing a frame"
           @worker_queue.push [:frame, fd, frame]
         end