module Net::SSH::ForwardedBufferedIo

Fixes for two issues by Miklós Fazekas:

* if client closes a forwarded connection, but the server is
  reading, net-ssh terminates with IOError socket closed.
* if client force closes (RST) a forwarded connection, but
  server is reading, net-ssh terminates with [an exception]

See:

http://net-ssh.lighthouseapp.com/projects/36253/tickets/7
http://github.com/net-ssh/net-ssh/tree/portfwfix

Public Instance Methods

fill(n=8192) click to toggle source
Calls superclass method
# File lib/net/ssh/buffered_io.rb, line 170
def fill(n=8192)
  begin
    super(n)
  rescue Errno::ECONNRESET => e
    debug { "connection was reset => shallowing exception:#{e}" }
    return 0
  rescue IOError => e
    if e.message =~ /closed/ then
      debug { "connection was reset => shallowing exception:#{e}" }
      return 0
    else
      raise
    end
  end
end
send_pending() click to toggle source
Calls superclass method
# File lib/net/ssh/buffered_io.rb, line 186
def send_pending
  begin
    super
  rescue Errno::ECONNRESET => e
    debug { "connection was reset => shallowing exception:#{e}" }
    return 0
  rescue IOError => e
    if e.message =~ /closed/ then
      debug { "connection was reset => shallowing exception:#{e}" }
      return 0
    else
      raise
    end
  end
end