From bc9d396610b7882573d1a5ab257e19a296825d1d Mon Sep 17 00:00:00 2001 From: ocean Date: Sun, 4 Jul 2004 16:29:03 +0000 Subject: [PATCH] * 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/trunk@6580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/drb/drb.rb | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index db3b165663..fe8d63386c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jul 5 01:20:17 Hirokazu Yamamoto + + * 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) + Sun Jul 4 12:24:50 2004 Kouhei Sutou * lib/rss/rss.rb: added copyright header. diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 829b9cb916..8919a946b9 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