Module Net::SSH::ForwardedBufferedIo

  1. lib/net/ssh/buffered_io.rb

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

Methods

public instance

  1. fill
  2. send_pending

Public instance methods

fill (n=8192)
[show source]
     # File lib/net/ssh/buffered_io.rb, line 165
165:     def fill(n=8192)
166:       begin
167:         super(n)
168:       rescue Errno::ECONNRESET => e
169:         debug { "connection was reset => shallowing exception:#{e}" }
170:         return 0
171:       rescue IOError => e                                 
172:         if e.message =~ /closed/ then 
173:           debug { "connection was reset => shallowing exception:#{e}" }
174:           return 0
175:         else
176:           raise
177:         end 
178:       end
179:     end
send_pending ()
[show source]
     # File lib/net/ssh/buffered_io.rb, line 181
181:     def send_pending
182:       begin
183:         super                                                          
184:       rescue Errno::ECONNRESET => e
185:         debug { "connection was reset => shallowing exception:#{e}" }
186:         return 0
187:       rescue IOError => e
188:         if e.message =~ /closed/ then 
189:           debug { "connection was reset => shallowing exception:#{e}" }
190:           return 0
191:         else
192:           raise
193:         end
194:       end
195:     end