lib/httpx/selector.rb in httpx-0.15.1 vs lib/httpx/selector.rb in httpx-0.15.2
- old
+ new
@@ -93,17 +93,21 @@
rescue IOError, SystemCallError
@selectables.reject!(&:closed?)
retry
end
- readers.each do |io|
- yield io
+ if writers
+ readers.each do |io|
+ yield io
- # so that we don't yield 2 times
- writers.delete(io)
- end if readers
+ # so that we don't yield 2 times
+ writers.delete(io)
+ end if readers
- writers.each(&block) if writers
+ writers.each(&block)
+ else
+ readers.each(&block) if readers
+ end
end
def select_one(interval)
io = @selectables.first