Use store instead of fetch_add for atomics

This commit is contained in:
Dreaded_X 2025-04-18 14:58:15 +02:00
parent 95e47c708c
commit fb815e9fe4
Signed by: Dreaded_X
GPG Key ID: 5A0CBFE3C3377FAA

View File

@ -19,15 +19,15 @@ pub struct Stats {
impl Stats { impl Stats {
pub fn add_connection(&self) { pub fn add_connection(&self) {
self.connections.fetch_add(1, Ordering::Relaxed); self.connections.store(1, Ordering::Relaxed);
} }
pub fn add_rx_bytes(&self, n: usize) { pub fn add_rx_bytes(&self, n: usize) {
self.rx.fetch_add(n, Ordering::Relaxed); self.rx.store(n, Ordering::Relaxed);
} }
pub fn add_tx_bytes(&self, n: usize) { pub fn add_tx_bytes(&self, n: usize) {
self.tx.fetch_add(n, Ordering::Relaxed); self.tx.store(n, Ordering::Relaxed);
} }
pub fn connections(&self) -> usize { pub fn connections(&self) -> usize {