If we are running out of descriptors, drop an old connection and wait

pull/88/head
Frank Denis 2 years ago
parent 3499fd2d10
commit 479cb956f1

@ -292,6 +292,10 @@ async fn tcp_acceptor(globals: Arc<Globals>, tcp_listener: TcpListener) -> Resul
continue;
}
warn!("TCP accept error: {}", e);
if let Some(tx_oldest) = active_connections.lock().pop_back() {
let _ = tx_oldest.send(());
}
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
}
};

Loading…
Cancel
Save