class Protocol::HTTP2::Dependency

def add_child(dependency)

def add_child(dependency)
	@children ||= {}
	@children[dependency.id] = dependency
	
	dependency.parent = self
	
	if @ordered_children
		# Binary search for insertion point:
		index = @ordered_children.bsearch_index do |child|
			child.weight >= dependency.weight
		end
		
		if index
			@ordered_children.insert(index, dependency)
		else
			@ordered_children.push(dependency)
		end
		
		@total_weight += dependency.weight
	end
end