lib/test_queue/iterator.rb in test-queue-0.2.2 vs lib/test_queue/iterator.rb in test-queue-0.2.4
- old
+ new
@@ -18,10 +18,11 @@
def each
fail 'already used this iterator' if @done
while true
client = connect_to_master('POP')
+ break if client.nil?
r, w, e = IO.select([client], nil, [client], nil)
break if !e.empty?
if data = client.read(65536)
client.close
@@ -56,9 +57,11 @@
else
UNIXSocket.new(@sock)
end
sock.puts(cmd)
sock
+ rescue Errno::EPIPE
+ nil
end
include Enumerable
def empty?