From f66ecf4d96400160720d162fdefba79524e1c44b Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Sun, 10 May 2026 00:21:12 +0200 Subject: [PATCH] fix not disconnecting when backend kicks player --- prudpv1/src/executables/proxy_secure.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prudpv1/src/executables/proxy_secure.rs b/prudpv1/src/executables/proxy_secure.rs index c338ef9..3f3b7c6 100644 --- a/prudpv1/src/executables/proxy_secure.rs +++ b/prudpv1/src/executables/proxy_secure.rs @@ -75,16 +75,16 @@ pub async fn start(param: ProxyStartupParam) { return; }; - loop { + 'a: loop { tokio::select! { data = conn.recv() => { let Some(data) = data else { - return; + break 'a; }; if let Err(e) = stream.send_buffer(&data[..]).await{ error!("error sending data to backend: {}", e); - return; + break 'a; } }, data = stream.read_buffer() => { @@ -92,12 +92,12 @@ pub async fn start(param: ProxyStartupParam) { Ok(d) => d, Err(e) => { error!("error reveiving data from backend: {}", e); - return; + break 'a; } }; if conn.send(data).await == None{ - return; + break 'a; } }, _ = sleep(Duration::from_secs(10)) => { @@ -105,6 +105,7 @@ pub async fn start(param: ProxyStartupParam) { } } } + conn.close_connection().await; }); } }