about summary refs log tree commit homepage
path: root/lib/rainbows.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r--lib/rainbows.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 8a41586..a252ba6 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -86,6 +86,12 @@ module Rainbows
   end
   autoload :Fiber, 'rainbows/fiber' # core class
 
+  # returns nil if accept fails
+  def self.accept(sock)
+    sock.accept_nonblock
+  rescue Errno::EAGAIN, Errno::ECONNABORTED
+  end
+
 end
 
 # inject the Rainbows! method into Unicorn::Configurator