]> git.proxmox.com Git - proxmox-backup.git/commitdiff
proxy: log if there are too many open connections
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Nov 2020 07:49:35 +0000 (08:49 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Nov 2020 07:49:35 +0000 (08:49 +0100)
src/bin/proxmox-backup-proxy.rs

index 42dfc11aa713044195c9c77b497a5cbfe812b451..4fef4274ed24bc83e08f7bd31162e2fdf7fa82e9 100644 (file)
@@ -167,11 +167,11 @@ fn accept_connections(
     debug: bool,
 ) -> tokio::sync::mpsc::Receiver<Result<tokio_openssl::SslStream<tokio::net::TcpStream>, Error>> {
 
-    let (sender, receiver) = tokio::sync::mpsc::channel(1024);
+    const MAX_PENDING_ACCEPTS: usize = 1024;
 
-    let accept_counter = Arc::new(());
+    let (sender, receiver) = tokio::sync::mpsc::channel(MAX_PENDING_ACCEPTS);
 
-    const MAX_PENDING_ACCEPTS: usize = 1024;
+    let accept_counter = Arc::new(());
 
     tokio::spawn(async move {
         loop {
@@ -186,9 +186,7 @@ fn accept_connections(
                     let mut sender = sender.clone();
 
                     if Arc::strong_count(&accept_counter) > MAX_PENDING_ACCEPTS {
-                        if debug {
-                            eprintln!("connection rejected - to many open connections");
-                        }
+                        eprintln!("connection rejected - to many open connections");
                         continue;
                     }