Kouhei Sutou
null+****@clear*****
Sat Mar 15 20:42:49 JST 2014
Kouhei Sutou 2014-03-15 20:42:49 +0900 (Sat, 15 Mar 2014) New Revision: 6f061d7359db3bb37d616540b28b77635d078fd7 https://github.com/ranguba/gqtp/commit/6f061d7359db3bb37d616540b28b77635d078fd7 Message: gqtp-proxy: support EventMachine backend Modified files: bin/gqtp-proxy Modified: bin/gqtp-proxy (+16 -8) =================================================================== --- bin/gqtp-proxy 2014-03-15 20:42:33 +0900 (7ae2a1b) +++ bin/gqtp-proxy 2014-03-15 20:42:49 +0900 (18bbaf5) @@ -1,6 +1,6 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8; mode: ruby -*- # -# Copyright (C) 2012 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -49,12 +49,13 @@ parser.on("--upstream-port=PORT", Integer, "(#{options.upstream_port})") do |port| options.upstream_port = port end -available_backends = ["thread", "synchronous", "coolio"].join(", ") -parser.on("--backend=BACKEND", +available_backends = [:thread, :synchronous, :coolio, :eventmachine] +available_backends_label = available_backends.join(", ") +parser.on("--backend=BACKEND", available_backends, "Use BACKEND for connection", - "[#{available_backends}]", + "[#{available_backends_label}]", "(#{options.backend})") do |backend| - options.backend = backend.to_sym + options.backend = backend end begin @@ -73,5 +74,12 @@ proxy = GQTP::Proxy.new(:listen_host => options.listen_host, :listen_port => options.listen_port, :upstream_host => options.upstream_host, :upstream_port => options.upstream_port, - :connection => options.backend) -proxy.run.wait + :backend => options.backend) +if options.backend == :eventmachine + require "eventmachine" + EventMachine.run do + proxy.run + end +else + proxy.run.wait +end -------------- next part -------------- HTML����������������������������...Download