Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
daa6df38c964ccb88a3c5541882adc56d92dc8b2 blob 776 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
 
# -*- encoding: binary -*-
# :enddoc:
module Rainbows::Epoll::Server
  @@nr = 0
  IN = SleepyPenguin::Epoll::IN | SleepyPenguin::Epoll::ET
  MAX = Rainbows.server.worker_connections
  THRESH = MAX - 1
  LISTENERS = Rainbows::HttpServer::LISTENERS
  EP = Rainbows::EP

  def self.nr
    @@nr
  end

  # rearms all listeners when there's a free slot
  def self.decr
    THRESH == (@@nr -= 1) and LISTENERS.each { |sock| EP.set(sock, IN) }
  end

  def self.extended(sock)
    EP.set(sock, IN)
  end

  def epoll_run
    return EP.delete(self) if @@nr >= MAX
    while io = kgio_tryaccept(Rainbows::Client)
      @@nr += 1
      # there's a chance the client never even sees epoll for simple apps
      io.epoll_once
      return EP.delete(self) if @@nr >= MAX
    end
  end
end
debug log:

solving daa6df3 ...
found daa6df3 in http://bogomips.org/rainbows-public/20170402002615.GA32751@starla/
found ab5a49f in http://bogomips.org/rainbows.git
preparing index
index prepared:
100644 ab5a49f4ca44b8fda4af88738561d952ff6a0341	lib/rainbows/epoll/server.rb

applying [1/1] http://bogomips.org/rainbows-public/20170402002615.GA32751@starla/
diff --git a/lib/rainbows/epoll/server.rb b/lib/rainbows/epoll/server.rb
index ab5a49f..daa6df3 100644

Checking patch lib/rainbows/epoll/server.rb...
Applied patch lib/rainbows/epoll/server.rb cleanly.

index at:
100644 daa6df38c964ccb88a3c5541882adc56d92dc8b2	lib/rainbows/epoll/server.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