diff options
Diffstat (limited to 'lib/rainbows')
-rw-r--r-- | lib/rainbows/thread_pool.rb | 3 | ||||
-rw-r--r-- | lib/rainbows/thread_spawn.rb | 5 |
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index 3ef719a..a68fcc6 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -44,8 +44,7 @@ module Rainbows def sync_worker s = LISTENERS.first begin - process_client(s.accept) - rescue Errno::EINTR, Errno::ECONNABORTED + c = Rainbows.sync_accept(s) and process_client(c) rescue => e Error.listen_loop(e) end while G.alive diff --git a/lib/rainbows/thread_spawn.rb b/lib/rainbows/thread_spawn.rb index eb3ca75..75cc150 100644 --- a/lib/rainbows/thread_spawn.rb +++ b/lib/rainbows/thread_spawn.rb @@ -34,8 +34,8 @@ module Rainbows # unlikely one. Since this case is (or should be) uncommon, # just busy wait when we have to. sleep(0.01) - else - klass.new(l.accept) do |c| + elsif c = Rainbows.sync_accept(l) + klass.new(c) do |c| begin lock.synchronize { G.cur += 1 } process_client(c) @@ -44,7 +44,6 @@ module Rainbows end end end - rescue Errno::EINTR, Errno::ECONNABORTED rescue => e Error.listen_loop(e) end while G.alive |