bin/em-proxy in em-proxy-0.1.7 vs bin/em-proxy in em-proxy-0.1.8

- old
+ new

@@ -22,18 +22,26 @@ opts.on("-r", "--relay [hostname:port]", String, "Relay endpoint: hostname:port") do |v| options[:relay] = v.split(":") end + opts.on("-s", "--socket [filename]", String, "Relay endpoint: unix filename") do |v| + options[:socket] = v + end + opts.on("-v", "--verbose", "Run in debug mode") do |v| options[:verbose] = v end end.parse! Proxy.start(:host => "0.0.0.0", :port => options[:listen] , :debug => options[:verbose]) do |conn| - conn.server :relay, :host => options[:relay].first, :port => options[:relay].last.to_i + if options[:socket] + conn.server :socket, :socket => options[:socket] + else + conn.server :relay, :host => options[:relay].first, :port => options[:relay].last.to_i + end options[:duplex].each_with_index do |backend,i| hostname, port = backend.split(":") conn.server "backend_#{i}".intern, :host => hostname, :port => port.to_i end if options[:duplex] @@ -43,6 +51,10 @@ end conn.on_response do |server, resp| resp if server == :relay end -end \ No newline at end of file + + conn.on_finish do |server| + :close if server == :relay + end +end