Permalink
Browse files

ensure connection is alive after checking a connection out

  • Loading branch information...
1 parent eaaecba commit 8a48243c08de1dcb1adb5b116c8e354c5d9b0efa Arya Asemanfar committed Jun 26, 2009
Showing with 9 additions and 5 deletions.
  1. +1 −1 Rakefile
  2. +1 −0 lib/pandemic/client_side/cluster_connection.rb
  3. +4 −0 lib/pandemic/client_side/connection.rb
  4. +3 −4 pandemic.gemspec
View
@@ -2,7 +2,7 @@ require 'rubygems'
require 'rake'
require 'echoe'
-Echoe.new('pandemic', '0.3.7') do |p|
+Echoe.new('pandemic', '0.3.8') do |p|
p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
p.url = "https://github.com/arya/pandemic/"
p.author = "Arya Asemanfar"
@@ -89,6 +89,7 @@ def checkout_connection(key)
loop do
if select_from.size > 0
connection = select_from.pop
+ connection.ensure_alive!
if key.nil?
@grouped_available[key].delete(connection)
else
@@ -10,6 +10,10 @@ def initialize(host, port, key)
def alive?
@socket && !@socket.closed?
end
+
+ def ensure_alive!
+ connect unless alive?
+ end
private
def connect
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{pandemic}
- s.version = "0.3.7"
+ s.version = "0.3.8"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Arya Asemanfar"]
@@ -11,18 +11,17 @@ Gem::Specification.new do |s|
s.email = %q{aryaasemanfar@gmail.com}
s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "pandemic.gemspec", "Rakefile", "README.markdown", "test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
- s.has_rdoc = true
s.homepage = %q{https://github.com/arya/pandemic/}
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pandemic", "--main", "README.markdown"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{pandemic}
- s.rubygems_version = %q{1.3.1}
+ s.rubygems_version = %q{1.3.4}
s.summary = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
s.test_files = ["test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
+ s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<shoulda>, [">= 0"])

0 comments on commit 8a48243

Please sign in to comment.