about summary refs log tree commit homepage
path: root/lib/rainbows/fiber_pool.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/fiber_pool.rb')
-rw-r--r--lib/rainbows/fiber_pool.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/rainbows/fiber_pool.rb b/lib/rainbows/fiber_pool.rb
index 25f086e..2a1c5f7 100644
--- a/lib/rainbows/fiber_pool.rb
+++ b/lib/rainbows/fiber_pool.rb
@@ -29,13 +29,11 @@ module Rainbows
       begin
         schedule do |l|
           fib = pool.shift or break # let another worker process take it
-          io = begin
-            l.accept_nonblock
-          rescue Errno::EAGAIN, Errno::ECONNABORTED
+          if io = Rainbows.accept(l)
+            fib.resume(Fiber::IO.new(io, fib))
+          else
             pool << fib
-            next
           end
-          fib.resume(Fiber::IO.new(io, fib))
         end
       rescue => e
         Error.listen_loop(e)