|
@ -13,7 +13,6 @@ use std::collections::{HashMap, HashSet}; |
|
|
use std::io::{BufRead, BufReader, Lines, Write}; |
|
|
use std::io::{BufRead, BufReader, Lines, Write}; |
|
|
use std::net::{SocketAddr, TcpStream}; |
|
|
use std::net::{SocketAddr, TcpStream}; |
|
|
use std::path::PathBuf; |
|
|
use std::path::PathBuf; |
|
|
#[cfg(feature = "latest_rust")] |
|
|
|
|
|
use std::sync::atomic::{AtomicU64, Ordering}; |
|
|
use std::sync::atomic::{AtomicU64, Ordering}; |
|
|
use std::sync::{Arc, Mutex}; |
|
|
use std::sync::{Arc, Mutex}; |
|
|
use std::time::Duration; |
|
|
use std::time::Duration; |
|
@ -269,12 +268,10 @@ impl Connection { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#[cfg(feature = "latest_rust")] |
|
|
|
|
|
struct Counter { |
|
|
struct Counter { |
|
|
value: AtomicU64, |
|
|
value: AtomicU64, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#[cfg(feature = "latest_rust")] |
|
|
|
|
|
impl Counter { |
|
|
impl Counter { |
|
|
fn new() -> Self { |
|
|
fn new() -> Self { |
|
|
Counter { value: 0.into() } |
|
|
Counter { value: 0.into() } |
|
@ -286,26 +283,6 @@ impl Counter { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#[cfg(not(feature = "latest_rust"))] |
|
|
|
|
|
struct Counter { |
|
|
|
|
|
value: Mutex<u64>, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(feature = "latest_rust"))] |
|
|
|
|
|
impl Counter { |
|
|
|
|
|
fn new() -> Self { |
|
|
|
|
|
Counter { |
|
|
|
|
|
value: Mutex::new(0), |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn next(&self) -> u64 { |
|
|
|
|
|
let mut value = self.value.lock().unwrap(); |
|
|
|
|
|
*value += 1; |
|
|
|
|
|
*value |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub struct Daemon { |
|
|
pub struct Daemon { |
|
|
daemon_dir: PathBuf, |
|
|
daemon_dir: PathBuf, |
|
|
network: Network, |
|
|
network: Network, |
|
|