Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mmm instance_eval fun on 1.9.x

  • Loading branch information...
commit 6c9754ea9ed6a8c272f4c771cc2e636807b1cb90 1 parent 936da05
Ilya Grigorik authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 lib/hydra/proxy.rb
15 lib/hydra/proxy.rb
View
@@ -22,7 +22,7 @@ def initialize(options)
@hosts = @hosts.inject({}) {|h,k| h[@hosts.index(k)] = k; h}
@log.info "Establishing #{@hosts.size} SOCKS5 tunnels"
- @live = {}
+ @@live = {}
@pids = []
end
@@ -41,15 +41,15 @@ def start!
@pids << EM.system(tunnel) do |cmd, out|
@log.error ["Connection closed", out, @hosts[index]]
- @live.delete(index)
+ @@live.delete(index)
- if @live.empty?
+ if @@live.empty?
@log.info "No live tunnels left, exiting"
exit
end
end
- @live[index] = host
+ @@live[index] = host
end
at_exit do
@@ -60,10 +60,11 @@ def start!
end
@log.info "Starting proxy on port #{@listen}"
- ::Proxy.start(:host => "0.0.0.0", :port => @listen) do |conn|
- tunnel = @live.keys.shuffle.first
- @log.info ["Routing request to", tunnel, @hosts[tunnel]]
+ ::Proxy.start(:host => "0.0.0.0", :port => @listen, :debug => @verbose) do |conn|
+ tunnel = @@live.keys.shuffle.first
+
+ puts "routing connection to #{@@live[tunnel]}"
conn.server :srv, :host => "127.0.0.1", :port => 7000 + tunnel, :relay_client => true, :relay_server => true
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.