Fix up bridge_unreachable
This commit is contained in:
parent
0ede04164b
commit
610a579731
|
@ -368,7 +368,7 @@ impl BridgeAuth {
|
||||||
if let Some(v) = positions {
|
if let Some(v) = positions {
|
||||||
for (bucketnum, offset) in v.iter() {
|
for (bucketnum, offset) in v.iter() {
|
||||||
println!("Bucket num: {:?} and offset: {:?}", bucketnum, offset);
|
println!("Bucket num: {:?} and offset: {:?}", bucketnum, offset);
|
||||||
let bridgelines = match self.bridge_table.buckets.get(bucketnum) {
|
let mut bridgelines = match self.bridge_table.buckets.get(bucketnum) {
|
||||||
Some(bridgelines) => *bridgelines,
|
Some(bridgelines) => *bridgelines,
|
||||||
None => return res,
|
None => return res,
|
||||||
};
|
};
|
||||||
|
@ -526,14 +526,15 @@ impl BridgeAuth {
|
||||||
if let Some(v) = positions {
|
if let Some(v) = positions {
|
||||||
for (bucketnum, offset) in v.iter() {
|
for (bucketnum, offset) in v.iter() {
|
||||||
// Count how many bridges in this bucket are reachable
|
// Count how many bridges in this bucket are reachable
|
||||||
let numreachable = self.bridge_table.buckets[*bucketnum as usize]
|
let mut bucket = self.bridge_table.buckets.get(bucketnum).unwrap();
|
||||||
|
let numreachable = bucket
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|br| self.bridge_table.reachable.get(br).is_some())
|
.filter(|br| self.bridge_table.reachable.get(br).is_some())
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
// Remove the bridge from the bucket
|
// Remove the bridge from the bucket
|
||||||
assert!(self.bridge_table.buckets[*bucketnum as usize][*offset] == *bridge);
|
assert!(bucket[*offset] == *bridge);
|
||||||
self.bridge_table.buckets[*bucketnum as usize][*offset] = BridgeLine::default();
|
bucket[*offset] = BridgeLine::default();
|
||||||
|
|
||||||
// Is this bucket an open-invitation bucket?
|
// Is this bucket an open-invitation bucket?
|
||||||
if bdb.openinv_buckets.contains(bucketnum) {
|
if bdb.openinv_buckets.contains(bucketnum) {
|
||||||
|
|
|
@ -159,8 +159,8 @@ pub fn encrypt_cred_ids(
|
||||||
migrationkey_priv: &IssuerPrivKey,
|
migrationkey_priv: &IssuerPrivKey,
|
||||||
) -> Option<([u8; 16], [u8; ENC_MIGRATION_BYTES])> {
|
) -> Option<([u8; 16], [u8; ENC_MIGRATION_BYTES])> {
|
||||||
// Look up the bucket keys and form the attributes (Scalars)
|
// Look up the bucket keys and form the attributes (Scalars)
|
||||||
let fromkey = bridgetable.keys.get(from_id as usize)?;
|
let fromkey = bridgetable.keys.get(&from_id)?;
|
||||||
let tokey = bridgetable.keys.get(to_id as usize)?;
|
let tokey = bridgetable.keys.get(&to_id)?;
|
||||||
Some(encrypt_cred(
|
Some(encrypt_cred(
|
||||||
id,
|
id,
|
||||||
&bridge_table::to_scalar(from_id, fromkey),
|
&bridge_table::to_scalar(from_id, fromkey),
|
||||||
|
|
Loading…
Reference in New Issue