Compare commits

..

No commits in common. "686da48fe8e3d7784c5b2acd1045a36cac806789" and "6fcc730ee64ce6098f39e149700147d4d47c4cb1" have entirely different histories.

1 changed files with 3 additions and 3 deletions

View File

@ -83,13 +83,13 @@ impl RoutingTable {
impl Table for RoutingTable {
/// Learns the given address, inserting it in the hash map
fn learn(&mut self, addr: Address, prefix_len: Option<u8>, address: SocketAddr) {
// If prefix length is not set, treat the whole address as significant
// If prefix length is not set, treat the whole addess as significant
let prefix_len = match prefix_len {
Some(val) => val,
None => addr.len * 8
};
info!("New routing entry: {}/{} => {}", addr, prefix_len, addr_nice(address));
// Round the prefix length down to the next multiple of 8 and extract a prefix of that
// Round the prefix length down to the next multiple of 8 and extraxt a prefix of that
// length.
let group_len = prefix_len as usize / 8;
assert!(group_len <= 16);
@ -97,7 +97,7 @@ impl Table for RoutingTable {
group_bytes[..group_len].copy_from_slice(&addr.data[..group_len]);
// Create an entry
let routing_entry = RoutingEntry { address, bytes: addr, prefix_len };
// Add the entry to the routing table, creating a new list if the prefix group is empty.
// Add the entry to the routing table, creating a new list of the prefix group is empty.
match self.0.entry(group_bytes) {
hash_map::Entry::Occupied(mut entry) => entry.get_mut().push(routing_entry),
hash_map::Entry::Vacant(entry) => {