summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiklós Fazekas <mfazekas@szemafor.com>2010-03-16 20:08:13 +0100
committerMiklós Fazekas <mfazekas@szemafor.com>2010-03-16 20:08:13 +0100
commitab7a3ae2a92bf4f30cf4bcf533c4f102e7103647 (patch)
tree41bd92650573a91d3e41bf18c69da0511b1cf378 /lib
parent845eb8f97d437f14874a1cae64e29f52528fab33 (diff)
downloadnet-ssh-ab7a3ae2a92bf4f30cf4bcf533c4f102e7103647.tar.gz
Handling poptential exceptions in on_eof, and deadlock in tests
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ssh/service/forward.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/net/ssh/service/forward.rb b/lib/net/ssh/service/forward.rb
index 67b12ba..9e37dce 100644
--- a/lib/net/ssh/service/forward.rb
+++ b/lib/net/ssh/service/forward.rb
@@ -246,8 +246,20 @@ module Net; module SSH; module Service
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|