module Net::SSH::ForwardedBufferedIo

def fill(n = 8192)

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

def send_pending

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