Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
blob 4de705f43ad8705c5b546cf6f7cbb84a74ac635e 1005 bytes (raw)
name: lib/rainbows/coolio/thread_client.rb 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
# -*- encoding: binary -*-
# :enddoc:

RUBY_VERSION =~ %r{\A1\.8} and
  warn "Coolio and Threads do not mix well under Ruby 1.8"

class Rainbows::Coolio::ThreadClient < Rainbows::Coolio::Client
  def app_call input
    KATO.delete(self)
    disable if enabled?
    @env['rack.input'] = input
    app_dispatch # must be implemented by subclass
  end

  # this is only called in the master thread
  def response_write(response)
    return hijacked if @hp.hijacked?
    ev_write_response(*response, @hp.next?)
    rescue => e
      handle_error(e)
  end

  # fails-safe application dispatch, we absolutely cannot
  # afford to fail or raise an exception (killing the thread)
  # here because that could cause a deadlock and we'd leak FDs
  def app_response
    begin
      @env['REMOTE_ADDR'] = @_io.kgio_addr
      @hp.hijack_setup(@env, @_io)
      APP.call(@env.merge!(RACK_DEFAULTS))
    rescue => e
      Rainbows::Error.app(e) # we guarantee this does not raise
      [ 500, {}, [] ]
    end
  end
end

debug log:

solving 4de705f ...
found 4de705f in https://yhbt.net/rainbows.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).