about summary refs log tree commit homepage
path: root/lib/rainbows/rev/server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 03:09:47 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 03:15:50 +0000
commit68accc9930b0653b702553790d4ccd626a8dfdfe (patch)
tree2c51b14e785a8f7d8c06dbe8b7308b38b4a6880f /lib/rainbows/rev/server.rb
parenta35fd37ff0c81ca8130c18b7b77957bafe686f83 (diff)
downloadrainbows-68accc9930b0653b702553790d4ccd626a8dfdfe.tar.gz
One file per class/module should be easier for new
hackers to find.  Unindent rainbows/rev/core while
we're at it, too.
Diffstat (limited to 'lib/rainbows/rev/server.rb')
-rw-r--r--lib/rainbows/rev/server.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rainbows/rev/server.rb b/lib/rainbows/rev/server.rb
new file mode 100644
index 0000000..7363b5c
--- /dev/null
+++ b/lib/rainbows/rev/server.rb
@@ -0,0 +1,11 @@
+# -*- encoding: binary -*-
+# :enddoc:
+class Rainbows::Rev::Server < ::Rev::IO
+  CONN = Rainbows::Rev::CONN
+  # CL and MAX will be defined in the corresponding worker loop
+
+  def on_readable
+    return if CONN.size >= MAX
+    io = @_io.kgio_tryaccept and CL.new(io).attach(LOOP)
+  end
+end