rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 696bc8bed573b5e182a1fbe286529bba895476de 351 bytes (raw)
$ git show HEAD:lib/rainbows/event_machine/server.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 
# -*- encoding: binary -*-
module Rainbows::EventMachine::Server # :nodoc: all
  def close
    detach
    @io.close
  end

  # CL, CUR and MAX will be set when worker_loop starts
  def notify_readable
    return if CUR.size >= MAX
    io = @io.kgio_tryaccept or return
    sig = EM.attach_fd(io.fileno, false)
    CUR[sig] = CL.new(sig, io)
  end
end

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