Permalink
Browse files

:loop_wait option

  • Loading branch information...
delano committed May 1, 2011
1 parent 51f9192 commit b448fe7da9ade93b798d812fb0c89d6fd2f7659c
Showing with 13 additions and 3 deletions.
  1. +5 −0 CHANGELOG.rdoc
  2. +1 −1 Rakefile
  3. +7 −2 lib/net/ssh/gateway.rb
View
@@ -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]
View
@@ -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"
View
@@ -65,12 +65,17 @@ class Version < Net::SSH::Version
# 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 @@ def initiate_event_loop!
@thread = Thread.new do
while @active
@session_mutex.synchronize do
- @session.process(0.001)
+ @session.process(@loop_wait)
end
Thread.pass
end

0 comments on commit b448fe7

Please sign in to comment.