From 0dcd0f094a5505706fca4bf0735d332d531848fc Mon Sep 17 00:00:00 2001 From: ocean Date: Sun, 4 Jul 2004 16:29:03 +0000 Subject: * lib/drb/drb.rb(DRbConn self.open): If socket pool is full, close the socket whose last-access-time is oldest. (and add new one) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/drb/drb.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/drb') diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 4613e60628..c90259f87e 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -1080,11 +1080,14 @@ module DRb return succ, result ensure - @mutex.synchronize do - if @pool.size > POOL_SIZE or ! succ - conn.close if conn + if conn + if succ + @mutex.synchronize do + @pool.unshift(conn) + @pool.pop.close while @pool.size > POOL_SIZE + end else - @pool.unshift(conn) + conn.close end end end -- cgit v1.2.3