From 11a0b07cde0a622f5bfd430b7b78e9994467c850 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Dec 2013 10:01:51 +0000 Subject: buffer/read_write: broadcast_one must be non-blocking This non-Linux code path probably broke when we minimized our use of IO#nread. --- lib/dtas/buffer/read_write.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/dtas') diff --git a/lib/dtas/buffer/read_write.rb b/lib/dtas/buffer/read_write.rb index 53b11de..530a08d 100644 --- a/lib/dtas/buffer/read_write.rb +++ b/lib/dtas/buffer/read_write.rb @@ -26,12 +26,14 @@ module DTAS::Buffer::ReadWrite # :nodoc: # always block when we have a single target def broadcast_one(targets) buf = _rbuf - @to_io.readpartial(MAX_AT_ONCE, buf) + @to_io.read_nonblock(MAX_AT_ONCE, buf) n = targets[0].write(buf) # IO#write has write-in-full behavior @bytes_xfer += n :wait_readable rescue EOFError nil + rescue Errno::EAGAIN + :wait_readable rescue Errno::EPIPE, IOError => e __dst_error(targets[0], e) targets.clear -- cgit v1.2.3-24-ge0c7