diff --git a/src/libdoh/src/globals.rs b/src/libdoh/src/globals.rs index 196c820..5af43a8 100644 --- a/src/libdoh/src/globals.rs +++ b/src/libdoh/src/globals.rs @@ -43,7 +43,11 @@ impl ClientsCount { let mut count; while { count = self.0.load(Ordering::Relaxed); - count > 0 && self.0.compare_and_swap(count, count - 1, Ordering::Relaxed) != count + count > 0 + && self + .0 + .compare_exchange(count, count - 1, Ordering::Relaxed, Ordering::Relaxed) + != Ok(count) } {} count } diff --git a/src/libdoh/src/tls.rs b/src/libdoh/src/tls.rs index c239636..64a6988 100644 --- a/src/libdoh/src/tls.rs +++ b/src/libdoh/src/tls.rs @@ -85,7 +85,7 @@ impl DoH { server: Http, ) -> Result<(), DoHError> { let listener_service = async { - while let Ok((raw_stream, _client_addr)) = listener.accept().await { + while let Ok((raw_stream, _client_addr)) = listener.accept().await { let stream = match tls_acceptor.accept(raw_stream).await { Ok(stream) => stream, Err(_) => continue,