From 82ffae676bffd26fcf6d68737d778b2d1b87efbf Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Thu, 24 Jun 2010 12:46:06 -0500 Subject: [PATCH] =?UTF-8?q?RUBY-142=20(Fr=C3=A9d=C3=A9ric=20De=20Jaeger)?= =?UTF-8?q?=20fix=20for=20broken=20socket=20send?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mongo/connection.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/mongo/connection.rb b/lib/mongo/connection.rb index 1dc5edf..30ccbec 100644 --- a/lib/mongo/connection.rb +++ b/lib/mongo/connection.rb @@ -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}"