# File lib/mongrel.rb, line 809 def listener(options={},&blk) raise "Cannot call listener inside another listener block." if (@listener or @listener_name) ops = resolve_defaults(options) ops[:num_processors] ||= 950 ops[:timeout] ||= 0 @listener = Mongrel::HttpServer.new(ops[:host], ops[:port].to_i, ops[:num_processors].to_i, ops[:timeout].to_i) @listener_name = "#{ops[:host]}:#{ops[:port]}" @listeners[@listener_name] = @listener # Does the actual cloaking operation to give the new implicit self. if blk cloaker(&blk).bind(self).call end # all done processing this listener setup, reset implicit variables @listener = nil @listener_name = nil end