J
Joel VanderWerf
I've noticed that I can run a drb server on a firewalled host, and talk
to it from outside the firewall, if the client uses ssh tunneling to
forward the port. At least, this works for simple method calls without
blocks. The problem I'm seeing is that if a method on the server side
yields to a block on the client side, the connection hangs. There is no
problem with the same code within the firewall. I'm guessing that drb is
trying to open another port, which hasn't been forwarded thru the tunnel.
Is there an easy solution to this problem? Other than avoid using yield,
that is...
==== server.rb ====
require 'drb'
class Test
def each
4.times do |i|
yield i
end
end
def to_a
[0,1,2,3]
end
end
DRb.start_service('druby://your.host.here:9876', Test.new)
puts '[interrupt] to exit.'
sleep
===================
==== client.rb ====
require 'drb'
DRb.start_service
x = DRbObject.new(nil, 'druby://localhost:9876')
p x.to_a # works fine
x.each do |i| # hangs here
p i
end
===================
==== forwarding ====
$ ssh -N -L 9876:your.host.here:9876 your.host.here
====================
to it from outside the firewall, if the client uses ssh tunneling to
forward the port. At least, this works for simple method calls without
blocks. The problem I'm seeing is that if a method on the server side
yields to a block on the client side, the connection hangs. There is no
problem with the same code within the firewall. I'm guessing that drb is
trying to open another port, which hasn't been forwarded thru the tunnel.
Is there an easy solution to this problem? Other than avoid using yield,
that is...
==== server.rb ====
require 'drb'
class Test
def each
4.times do |i|
yield i
end
end
def to_a
[0,1,2,3]
end
end
DRb.start_service('druby://your.host.here:9876', Test.new)
puts '[interrupt] to exit.'
sleep
===================
==== client.rb ====
require 'drb'
DRb.start_service
x = DRbObject.new(nil, 'druby://localhost:9876')
p x.to_a # works fine
x.each do |i| # hangs here
p i
end
===================
==== forwarding ====
$ ssh -N -L 9876:your.host.here:9876 your.host.here
====================