lib/httpx/connection.rb in httpx-0.0.1 vs lib/httpx/connection.rb in httpx-0.0.2
- old
+ new
@@ -17,23 +17,19 @@
end
def next_tick(timeout: @timeout.timeout)
@selector.select(timeout) do |monitor|
if (channel = monitor.value)
- consume(channel)
+ channel.call
end
monitor.interests = channel.interests
end
end
- def close(channel = nil)
- if channel
- channel.close
- else
- @channels.each(&:close)
- next_tick until @selector.empty?
- end
+ def close
+ @channels.each(&:close)
+ next_tick until @channels.empty?
end
def reset
@channels.each(&:reset)
end
@@ -62,13 +58,8 @@
channel.on(:close) do
@channels.delete(channel)
@selector.deregister(channel)
end
@channels << channel
- end
-
- def consume(channel)
- ch = catch(:close) { channel.call }
- close(ch) if ch
end
end
end