lib/net/ssh/service/forward/remote-network-handler.rb in net-ssh-0.9.0 vs lib/net/ssh/service/forward/remote-network-handler.rb in net-ssh-1.0.0
- old
+ new
@@ -42,12 +42,14 @@
Thread.new do
begin
loop do
break if channel[:eof]
- data = @client.recv( @block_size )
- break if data.nil? or data.length < 1
- channel.send_data data
+ data = ""
+ while IO.select([@client],nil,nil,0.01)
+ data << @client.recv(@block_size)
+ end
+ channel.send_data data unless data.empty?
end
rescue Exception => e
@log.error "error while forwarding remote port: " +
"#{e.class}: #{e.message}\n " +
e.backtrace.join( "\n " )