Skip to main content

subnet_restricted

Function subnet_restricted 

Source
fn subnet_restricted(buckets: &[Bucket], idx: usize, entry: &Entry) -> bool
Expand description

Iterate the buckets and count entries in the same subnet as entry. Restricted if same-bucket matches >= MAX_MATCHED_SUBNET_IN_BUCKET or table-wide matches >= MAX_MATCHED_SUBNET_IN_TABLE.

Takes a borrow of buckets so the caller (add_entry) holds a single write lock across the check and the insert.