From 4f9aceacf43144761e95dc18126754f3a2ade211 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Thu, 5 Apr 2012 10:52:13 -0400 Subject: [PATCH] RUBY-433 fixes IOError stream closed --- lib/mongo/util/pool.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mongo/util/pool.rb b/lib/mongo/util/pool.rb index 76bb723..7d5c704 100644 --- a/lib/mongo/util/pool.rb +++ b/lib/mongo/util/pool.rb @@ -217,7 +217,9 @@ module Mongo if @pids[socket] != Process.pid @pids[socket] = nil @sockets.delete(socket) - socket.close if socket + if socket + socket.close unless socket.closed? + end checkout_new_socket else @checked_out << socket