Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
47159815cd1229cd8d3f5924b8c029b6f5919f30 blob 1331 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
43
44
45
46
47
48
49
50
51
52
53
54
55
 
# -*- encoding: binary -*-
# :enddoc:
# Generic IO wrapper for proxying pipe and socket objects
# this behaves more like Rainbows::Fiber::IO than anything,
# making it highly suitable for proxying data from pipes/sockets
class Rainbows::Revactor::Proxy < Rev::IO
  def initialize(io)
    @receiver = Actor.current
    super(io)
    attach(Rev::Loop.default)
  end

  def close
    if @_io
      super
      @_io = nil
    end
  end

  def each
    # when yield-ing, Revactor::TCP#write may raise EOFError
    # (instead of Errno::EPIPE), so we need to limit the rescue
    # to just readpartial and let EOFErrors during yield bubble up
    begin
      buf = readpartial(INPUT_SIZE)
    rescue EOFError
      break
    end while yield(buf) || true
  end

  # this may return more than the specified length, Rainbows! won't care...
  def readpartial(length)
    @receiver = Actor.current
    enable if attached? && ! enabled?

    Actor.receive do |filter|
      filter.when(T[:rainbows_io_input, self]) do |_, _, data|
        return data
      end

      filter.when(T[:rainbows_io_closed, self]) do
        raise EOFError, "connection closed"
      end
    end
  end

  def on_close
    @receiver << T[:rainbows_io_closed, self]
  end

  def on_read(data)
    @receiver << T[:rainbows_io_input, self, data ]
    disable
  end
end
debug log:

solving 4715981 ...
found 4715981 in http://bogomips.org/rainbows.git

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