Add max size to routing table

This commit is contained in:
Igor Katson 2023-11-30 15:35:08 +00:00
parent 16a4d22b6b
commit 4af26ae246
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 32 additions and 126 deletions

View file

@ -497,7 +497,7 @@ impl DhtState {
routing_table: Option<RoutingTable>,
listen_addr: SocketAddr,
) -> Self {
let routing_table = routing_table.unwrap_or_else(|| RoutingTable::new(id));
let routing_table = routing_table.unwrap_or_else(|| RoutingTable::new(id, None));
Self {
id,
next_transaction_id: AtomicU16::new(0),
@ -798,7 +798,7 @@ impl DhtWorker {
let mut futs = FuturesUnordered::new();
let filler = async {
let mut interval = tokio::time::interval(INACTIVITY_TIMEOUT);
tokio::time::sleep(INACTIVITY_TIMEOUT).await;
interval.tick().await;
let mut iteration = 0;
loop {
interval.tick().await;