[pbs-devel] [PATCH backup 2/2] proxy: fix accept future "rearming"

Wolfgang Bumiller w.bumiller at proxmox.com
Wed May 12 09:29:31 CEST 2021


this must happen regardless of whether we got an error

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/bin/proxmox-backup-proxy.rs | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index e8c31c4d..4bf3fb56 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -237,16 +237,18 @@ async fn accept_connection(
                 }
                 continue;
             }
-            res = &mut accept => match res {
-                Err(err) => {
-                    eprintln!("error accepting tcp connection: {}", err);
-                    continue;
-                }
-                Ok((new_sock, _addr)) => {
-                    // rearm the accept future:
-                    accept = Box::pin(listener.accept());
-
-                    sock = new_sock;
+            res = &mut accept => {
+                // rearm the accept future:
+                accept = Box::pin(listener.accept());
+
+                match res {
+                    Err(err) => {
+                        eprintln!("error accepting tcp connection: {}", err);
+                        continue;
+                    }
+                    Ok((new_sock, _addr)) => {
+                        sock = new_sock;
+                    }
                 }
             }
         };
-- 
2.20.1






More information about the pbs-devel mailing list