mirror of
https://github.com/DNSCrypt/doh-server.git
synced 2025-04-03 04:57:37 +03:00
compare_and_swap() was too simple and has been deprecated
This commit is contained in:
parent
741d28557d
commit
b281555860
2 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ impl DoH {
|
|||
server: Http<LocalExecutor>,
|
||||
) -> 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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue