summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-04 16:29:03 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-04 16:29:03 +0000
commitbc9d396610b7882573d1a5ab257e19a296825d1d (patch)
treef46a8ef393c5bb1940aadd048f70f159c55d0285 /lib
parent7255981a4d663dc77850ee46a60f657db613ca75 (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/drb/drb.rb11
1 files changed, 7 insertions, 4 deletions
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