class Rack::Handler::Mongrel2
Constants
- DEFAULT_OPTIONS
Public Class Methods
connection_factory(options)
click to toggle source
# File lib/rack/handler/mongrel2.rb, line 34 def self.connection_factory(options) klass = if custom = options.connection_factory begin M2R::ConnectionFactory.const_get(custom.classify) rescue NameError require "m2r/connection_factory/#{custom.underscore}" M2R::ConnectionFactory.const_get(custom.classify) end else M2R::ConnectionFactory end klass.new(options) end
run(app, options = {})
click to toggle source
# File lib/rack/handler/mongrel2.rb, line 15 def self.run(app, options = {}) options = OpenStruct.new( DEFAULT_OPTIONS.merge(options) ) threadsafe_parser = M2R::Parser.new adapter = M2R::RackHandler.new(app, connection_factory(options), threadsafe_parser) graceful = Proc.new { adapter.stop } trap("INT", &graceful) trap("TERM", &graceful) adapter.listen M2R.zmq_context.terminate end
valid_options()
click to toggle source
# File lib/rack/handler/mongrel2.rb, line 26 def self.valid_options { 'recv_addr=RECV_ADDR' => 'Receive address', 'send_addr=SEND_ADDR' => 'Send address', 'sender_id=UUID' => 'Sender UUID' } end