Use store instead of fetch_add for atomics
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 2m48s

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

View File

@ -19,15 +19,15 @@ pub struct Stats {
impl Stats {
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) {
self.rx.fetch_add(n, Ordering::Relaxed);
self.rx.store(n, Ordering::Relaxed);
}
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 {