Skip to content

Commit 2a6d088

Browse files
authored
Merge pull request #304 from tox-rs/consts
DHT consts improvements
2 parents a2a69bc + 7a37eb1 commit 2a6d088

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/toxcore/dht/server/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ type TcpOnionTx = mpsc::Sender<(InnerOnionResponse, SocketAddr)>;
4646
/// After random requests count exceeds this number `NODES_REQ_INTERVAL` will be
4747
/// used.
4848
pub const MAX_BOOTSTRAP_TIMES: u32 = 5;
49-
/// Interval in seconds of sending `NatPingRequest` packet.
50-
pub const NAT_PING_REQ_INTERVAL: u64 = 3;
5149
/// How often onion key should be refreshed.
5250
pub const ONION_REFRESH_KEY_INTERVAL: u64 = 7200;
5351
/// Interval in seconds for random `NodesRequest`.
@@ -69,6 +67,8 @@ pub const PRECOMPUTED_LRU_CACHE_SIZE: usize = KBUCKET_DEFAULT_SIZE as usize * KB
6967
KBUCKET_DEFAULT_SIZE as usize * (2 + 10); // For friend's close_nodes of 2 fake friends + 10 friends reserved
7068
/// Timeout in seconds for packet sending
7169
pub const DHT_SEND_TIMEOUT: u64 = 1;
70+
/// How often DHT main loop should be called.
71+
const MAIN_LOOP_INTERVAL: u64 = 1;
7272

7373
/// Struct that contains necessary data for `BootstrapInfo` packet.
7474
#[derive(Clone)]
@@ -371,7 +371,7 @@ impl Server {
371371
/// Run DHT main loop periodically. Result future will never be completed
372372
/// successfully.
373373
fn run_main_loop(self) -> impl Future<Item = (), Error = Error> + Send {
374-
let interval = Duration::from_secs(1);
374+
let interval = Duration::from_secs(MAIN_LOOP_INTERVAL);
375375
let wakeups = Interval::new(Instant::now(), interval);
376376
wakeups
377377
.map_err(|e| Error::new(ErrorKind::Other, format!("DHT server timer error: {:?}", e)))

0 commit comments

Comments
 (0)