Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'portfwfix' of http://github.com/mfazekas/net-ssh into p…

…ortfwfix
  • Loading branch information...
commit e06054d0f324a058cf1b9f3232b24c631ebcf612 2 parents 070f9b3 + ab7a3ae
@delano delano authored
Showing with 18 additions and 6 deletions.
  1. +14 −2 lib/net/ssh/service/forward.rb
  2. +4 −4 test/manual/test_forward.rb
View
16 lib/net/ssh/service/forward.rb
@@ -213,8 +213,20 @@ def prepare_client(client, channel, type)
# Handles server close on the sending side by Miklós Fazekas
channel.on_eof do |ch|
debug { "eof #{type} on #{type} forwarded channel" }
- ch[:socket].send_pending
- ch[:socket].shutdown Socket::SHUT_WR
+ begin
+ ch[:socket].send_pending
+ ch[:socket].shutdown Socket::SHUT_WR
+ rescue IOError => e
+ if e.message =~ /closed/ then
+ debug { "epipe in on_eof => shallowing exception:#{e}" }
+ else
+ raise
+ end
+ rescue Errno::EPIPE => e
+ debug { "epipe in on_eof => shallowing exception:#{e}" }
+ rescue Errno::ENOTCONN => e
+ debug { "enotconn in on_eof => shallowing exception:#{e}" }
+ end
end
channel.on_close do |ch|
View
8 test/manual/test_forward.rb
@@ -26,7 +26,7 @@ def localhost
end
def ssh_start_params
- [localhost ,ENV['USER']]
+ [localhost ,ENV['USER']] #:verbose => :debug
end
def find_free_port
@@ -37,7 +37,7 @@ def find_free_port
port
end
- def start_server_sending_lot_of_data(exceptions=nil)
+ def start_server_sending_lot_of_data(exceptions)
server = TCPServer.open(0)
Thread.start do
loop do
@@ -95,7 +95,7 @@ def test_loop_should_not_abort_when_local_side_of_forward_is_closed
end
end
session.loop(0.1) { client_done.empty? }
- assert_equal "Broken pipe", "#{server_exc.pop}"
+ assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
end
def test_loop_should_not_abort_when_local_side_of_forward_is_reset
@@ -118,7 +118,7 @@ def test_loop_should_not_abort_when_local_side_of_forward_is_reset
end
end
session.loop(0.1) { client_done.empty? }
- assert_equal "Broken pipe", "#{server_exc.pop}"
+ assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
end
def test_loop_should_not_abort_when_server_side_of_forward_is_closed
Please sign in to comment.
Something went wrong with that request. Please try again.