Sha256: 8ab3c79a2a5021d07e1273a2346a5ca7cdc249d8218ca6bfc089ce7860258a0d
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
module Mongrel2 class FiberHandler < Handler def initialize(*args) raise "This handler is just around for testing. don't use it, it'll suck." end def fiber_handle @fiber ||= Fiber.new do |request| loop do on_request(request) # run on_disconnect if the server disconnects if request.disconnect? on_disconnect request = Fiber.yield next end # get the response from on_request response = process(request) # run the response through a filter response = after_process(response, request) # send it back to the server on the PUB socket @connection.reply_http(request, response) after_reply(request, response) request = Fiber.yield end end end def listen loop do on_wait request = @connection.recv fiber_handle.resume(request) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
m2r-0.0.3 | lib/fiber_handler.rb |
m2r-0.0.2 | lib/fiber_handler.rb |