summaryrefslogtreecommitdiff
path: root/lib/net/ssh/service/forward.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/ssh/service/forward.rb')
-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 024a9cb..fa3e4f0 100644
--- a/lib/net/ssh/service/forward.rb
+++ b/lib/net/ssh/service/forward.rb
@@ -213,8 +213,20 @@ module Net; module SSH; module Service
# 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|