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