RUBY-142 (Frédéric De Jaeger) fix for broken socket send

This commit is contained in:
Kyle Banker 2010-06-24 12:46:06 -05:00
parent bdce8db3e6
commit 82ffae676b
1 changed files with 4 additions and 1 deletions

View File

@ -696,7 +696,10 @@ module Mongo
# Requires a packed message and an available socket,
def send_message_on_socket(packed_message, socket)
begin
socket.send(packed_message, 0)
while packed_message.size > 0
byte_sent = socket.send(packed_message, 0)
packed_message.slice!(0, byte_sent)
end
rescue => ex
close
raise ConnectionFailure, "Operation failed with the following exception: #{ex}"