Method: DTAS::Buffer::Splice#broadcast_one

Defined in:
lib/dtas/buffer/splice.rb

#broadcast_one(targets, limit = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dtas/buffer/splice.rb', line 30

def broadcast_one(targets, limit = nil)
  # single output is always non-blocking
  limit ||= MAX_AT_ONCE_1
  s = IO.trysplice(@to_io, nil, targets[0], nil, limit, F_MOVE)
  if Symbol === s
    targets # our one and only target blocked on write
  else
    @bytes_xfer += s
    :wait_readable # we want to read more from @to_io soon
  end
rescue Errno::EPIPE, IOError => e
  __dst_error(targets[0], e)
  targets.clear
  nil # do not return error here, we already spewed an error message
end