Update function definition for bridge update
This commit is contained in:
parent
80dd16f081
commit
6681289105
|
@ -309,9 +309,31 @@ impl BridgeAuth {
|
||||||
self.bridge_table.spares.insert(bnum);
|
self.bridge_table.spares.insert(bnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bridge_update(&mut self, bridge: &BridgeLine, bdb: &mut BridgeDb) -> bool {
|
// Update the details of a bridge in the bridge table. This assumes that the IP and Port
|
||||||
|
// of a given bridge remains the same and thus can be updated.
|
||||||
|
// First we must retrieve the list of reachable bridges, then we must search for any matching our partial key
|
||||||
|
// which will include the IP and Port. Then we can replace the original bridge with the updated bridge or else
|
||||||
|
// or else just replace the info field.
|
||||||
|
pub fn bridge_update(&mut self, bridge: &BridgeLine) -> bool {
|
||||||
|
|
||||||
false
|
let mut res: bool = false; //default False to assume that update failed
|
||||||
|
//Needs to be updated since bridge will only match on some fields.
|
||||||
|
let positions = self.bridge_table.reachable.get_key_value(bridge);
|
||||||
|
if let Some(v) = positions {
|
||||||
|
println!("Bridge v: {:?} has same IP and Port as bridge {:?}.", v.0, bridge);
|
||||||
|
let mut w = *v.0;
|
||||||
|
w.info = bridge.info;
|
||||||
|
if v.0 == bridge {
|
||||||
|
println!("Yay");
|
||||||
|
println!("Now bridge v: {:?} has all fields the same as bridge {:?}.", v.0, bridge);
|
||||||
|
}else {
|
||||||
|
println!("Boo");
|
||||||
|
}
|
||||||
|
res = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark a bridge as unreachable
|
/// Mark a bridge as unreachable
|
||||||
|
|
Loading…
Reference in New Issue