From b448fe7da9ade93b798d812fb0c89d6fd2f7659c Mon Sep 17 00:00:00 2001 From: delano Date: Sat, 30 Apr 2011 20:38:50 -0400 Subject: :loop_wait option --- CHANGELOG.rdoc | 5 +++++ Rakefile | 2 +- lib/net/ssh/gateway.rb | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index e4620c8..415af58 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,8 @@ +=== 1.1.0 / 30 Apr 2011 + +* Fix for sporadicly stalled SSH connections in Ruby 1.9 [Mat Trudel] +* Decrease wait time within Net::SSH session loop [Grant Hutchins, Michael Schubert] + === 1.0.1 / 1 Feb 2009 * Allow local port to be specified [Will Klancnik] diff --git a/Rakefile b/Rakefile index 520728d..9a6b76e 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,7 @@ Echoe.new('net-ssh-gateway', version) do |p| p.changelog = "CHANGELOG.rdoc" p.author = "Jamis Buck" - p.email = "jamis@jamisbuck.org" + p.email = "net-ssh-gateway@solutious.com" p.summary = "A simple library to assist in establishing tunneled Net::SSH connections" p.url = "http://net-ssh.rubyforge.org/gateway" diff --git a/lib/net/ssh/gateway.rb b/lib/net/ssh/gateway.rb index 49be1b1..c38f554 100644 --- a/lib/net/ssh/gateway.rb +++ b/lib/net/ssh/gateway.rb @@ -65,12 +65,17 @@ class Net::SSH::Gateway # are passed as given to that method to start up the gateway connection. # # gateway = Net::SSH::Gateway.new('host', 'user', :password => "password") + # + # As of 1.1 there is an additional option to specify the wait time for + # the gateway thread. The default is 0.001 seconds and can be changed + # with the :loop_wait option. + # def initialize(host, user, options={}) @session = Net::SSH.start(host, user, options) @session_mutex = Mutex.new @port_mutex = Mutex.new @next_port = MAX_PORT - + @loop_wait = options.delete(:loop_wait) || 0.001 initiate_event_loop! end @@ -190,7 +195,7 @@ class Net::SSH::Gateway @thread = Thread.new do while @active @session_mutex.synchronize do - @session.process(0.001) + @session.process(@loop_wait) end Thread.pass end -- cgit v1.2.1