Changed test blocking parity from static mut: bool to static: AtomicBool
This commit is contained in:
parent
4ff193cabe
commit
927e29bb43
|
@ -1,5 +1,6 @@
|
||||||
// Yeahbut December 2023
|
// Yeahbut December 2023
|
||||||
|
|
||||||
|
use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf};
|
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf};
|
||||||
|
|
||||||
use purple_cello_mc_protocol::{
|
use purple_cello_mc_protocol::{
|
||||||
|
@ -19,13 +20,12 @@ enum PlayerAllowed {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_player(player: Player) -> Result<PlayerAllowed> {
|
fn check_player(player: Player) -> Result<PlayerAllowed> {
|
||||||
static mut PARITY: bool = true;
|
static PARITY: AtomicBool = AtomicBool::new(true);
|
||||||
let parity: bool;
|
let parity: bool;
|
||||||
unsafe {
|
parity = PARITY.load(Ordering::Relaxed);
|
||||||
parity = PARITY;
|
PARITY.store(!parity, Ordering::Relaxed);
|
||||||
PARITY = !PARITY;
|
if parity {
|
||||||
}
|
// if player.name.to_lowercase() == "yeahbut" {
|
||||||
if parity { //player.name.to_lowercase() == "yeahbut" {
|
|
||||||
Ok(PlayerAllowed::True(player))
|
Ok(PlayerAllowed::True(player))
|
||||||
} else {
|
} else {
|
||||||
Ok(PlayerAllowed::False("Testing blocking, try again.".to_string()))
|
Ok(PlayerAllowed::False("Testing blocking, try again.".to_string()))
|
||||||
|
|
Loading…
Reference in New Issue