Skip to content

trie.go:insert - fix proposal for Ipv4\Ipv6 in same trie #42

@dmineev

Description

@dmineev
func (p *prefixTrie) insert(network rnet.Network, entry RangerEntry) (bool, error) {
        
            *                *                   *

	// No existing child, insert new leaf trie.
	if existingChild == nil || existingChild.network.Number == nil {

          *                   *                   *

	}

          *                  *                  *

	// Check whether it is necessary to insert additional path prefix between current trie and existing child,
	// in the case that inserted network diverges on its path to existing child.
	if lcb, err := network.LeastCommonBitPosition(existingChild.network); err == nil {

          *                   *                  *

	} else {
		return false, err
	}

	return existingChild.insert(network, entry)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions