diff options
| author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-04 16:29:03 +0000 |
|---|---|---|
| committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-04 16:29:03 +0000 |
| commit | f788a3b206edfcaedda33dddaaadb8f9fc6cefa9 (patch) | |
| tree | 61056cd4be98652b0049933e871aeda74a5bcfee /lib | |
| parent | 672b0304fbce0a2f72b763b7a809c81ae9f17244 (diff) | |
| download | ruby-f788a3b206edfcaedda33dddaaadb8f9fc6cefa9.tar.gz ruby-f788a3b206edfcaedda33dddaaadb8f9fc6cefa9.tar.xz ruby-f788a3b206edfcaedda33dddaaadb8f9fc6cefa9.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/drb/drb.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 4613e6062..c90259f87 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 |
