From 41402209f5754f25cadd822d4f2e663483361f79 Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Sat, 9 Mar 2024 17:30:47 -0500 Subject: [PATCH] Delay recycling bridge table keys until we're done with them --- crates/lox-library/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/lox-library/src/lib.rs b/crates/lox-library/src/lib.rs index 35478b4..40e4d8c 100644 --- a/crates/lox-library/src/lib.rs +++ b/crates/lox-library/src/lib.rs @@ -574,7 +574,6 @@ impl BridgeAuth { return ReplaceSuccess::NotReplaced; }; self.bridge_table.spares.remove(&spare); - self.bridge_table.recycleable_keys.push(spare); // Get the actual bridges from the spare bucket let spare_bucket = match self.bridge_table.buckets.remove(&spare) { Some(spare_bucket) => spare_bucket, @@ -583,6 +582,7 @@ impl BridgeAuth { }; // Remove the spare bucket uid from the keys map self.bridge_table.keys.remove(&spare); + self.bridge_table.recycleable_keys.push(spare); let mut replacement: &BridgeLine = &BridgeLine::default(); // Make the first spare the replacement bridge, add the others to the set of // unallocated_bridges