Skip to content

Commit

Permalink
Fixed Issue #40
Browse files Browse the repository at this point in the history
  • Loading branch information
Tammo Freese committed Jul 19, 2012
1 parent f2ce7ba commit 4b0b8cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/em-mongo/connection.rb
Expand Up @@ -164,9 +164,11 @@ def receive_data(data)
end

if @buffer.more?
remaining_bytes= @buffer.size-@buffer.position
@buffer = BSON::ByteBuffer.new(@buffer.to_s[@buffer.position,remaining_bytes])
@buffer.rewind
if @buffer.position > 0
remaining_bytes= @buffer.size-@buffer.position
@buffer = BSON::ByteBuffer.new(@buffer.to_s[@buffer.position,remaining_bytes])
@buffer.rewind
end
else
@buffer.clear
end
Expand Down

0 comments on commit 4b0b8cc

Please sign in to comment.