Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
7ab2ef9282ecd258795465ce470370e802725f3e blob 1200 bytes (raw)

 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
37
38
39
40
41
42
 
# -*- encoding: binary -*-
# :enddoc:
class Rainbows::EventMachine::ThreadClient <
      Rainbows::EventMachine::Client

  def app_call input
    @deferred = true # we defer immediately
    set_comm_inactivity_timeout 0
    @env[RACK_INPUT] = input
    @env[REMOTE_ADDR] = @_io.kgio_addr
    @env[ASYNC_CALLBACK] = method(:write_async_response)
    @env[ASYNC_CLOSE] = EM::DefaultDeferrable.new
    @hp.hijack_setup(@env, @_io)
    app_dispatch # must be implemented by subclass
  end

  # this is only called in the master thread
  def response_write(response)
    if @hp.hijacked?
      @deferred = nil
      hijacked
    elsif nil == response[0] || -1 == response[0]
      @deferred = true
    else
      @deferred = nil
      ev_write_response(*response, @hp.next?)
    end
    rescue => e
      @deferred = nil
      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
    APP.call(@env.merge!(RACK_DEFAULTS))
    rescue => e
      Rainbows::Error.app(e) # we guarantee this does not raise
      [ 500, {}, [] ]
  end
end
debug log:

solving 7ab2ef9 ...
found 7ab2ef9 in http://bogomips.org/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/

applying [1/1] http://bogomips.org/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/
diff --git a/lib/rainbows/event_machine/thread_client.rb b/lib/rainbows/event_machine/thread_client.rb
new file mode 100644
index 0000000..7ab2ef9

Checking patch lib/rainbows/event_machine/thread_client.rb...
Applied patch lib/rainbows/event_machine/thread_client.rb cleanly.

index at:
100644 7ab2ef9282ecd258795465ce470370e802725f3e	lib/rainbows/event_machine/thread_client.rb

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git