1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-23 21:51:06 +01:00

Fix worker_avail (#336)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
fakeshadow 2021-04-15 19:20:02 -07:00 committed by GitHub
parent fdafc1dd65
commit 20c2da17ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,14 +116,11 @@ impl Availability {
panic!("Max WorkerHandle count is 512")
};
let off = 1 << idx as u128;
if avail {
self.0[offset] |= 1 << idx as u128;
self.0[offset] |= off;
} else {
let shift = 1 << idx as u128;
debug_assert_ne!(self.0[offset] & shift, 0);
self.0[offset] ^= shift;
self.0[offset] &= !off
}
}
@ -527,6 +524,9 @@ mod test {
aval.set_available(idx, false);
assert!(!aval.available());
aval.set_available(idx, false);
assert!(!aval.available());
}
fn multi(aval: &mut Availability, mut idx: Vec<usize>) {
@ -565,13 +565,6 @@ mod test {
single(&mut aval, 512);
}
#[test]
#[should_panic]
fn double_set_unavailable() {
let mut aval = Availability::default();
aval.set_available(233, false);
}
#[test]
fn pin_point() {
let mut aval = Availability::default();