class Protocol::HTTP2::Dependency

def consume_window(size)

Parameters:
  • amount (Integer) -- the amount of data to write. Defaults to the current window capacity.
def consume_window(size)
	# If there is an associated stream, give it priority:
	if stream = self.stream
		return if stream.window_updated(size)
	end
	
	# Otherwise, allow the dependent children to use up the available window:
	self.ordered_children&.delete_if do |child|
		if child.parent
			# Compute the proportional allocation:
			allocated = (child.weight * size) / @total_weight
			
			child.consume_window(allocated) if allocated > 0
			
			false
		else
			true
		end
	end
end