From 0fdea7ee21b1edba430f37bd3694726ebe5c0a0b Mon Sep 17 00:00:00 2001 From: ospab Date: Sat, 30 May 2026 22:09:23 +0300 Subject: [PATCH] fix(client): resolve borrow after move error in bridge.rs and clean up warnings --- ostp-client/src/bridge.rs | 4 ++-- ostp-client/src/transport/xhttp.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ostp-client/src/bridge.rs b/ostp-client/src/bridge.rs index d5b951e..748c586 100644 --- a/ostp-client/src/bridge.rs +++ b/ostp-client/src/bridge.rs @@ -335,7 +335,7 @@ impl Bridge { tx.send(UiEvent::Log(start_msg.to_string())).await.ok(); // Send an immediate Ping so the UI updates without a 60s delay - for session in sessions.iter_mut() { + for session in sessions_opt.as_mut().unwrap().iter_mut() { let ts = SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_millis() as u64; let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode()); if let Ok(ProtocolAction::SendDatagram(frame)) = session.machine.on_event(OstpEvent::Outbound(0, ping_payload)) { @@ -516,7 +516,7 @@ impl Bridge { let _ = tx.send(UiEvent::Log("Background reconnect successful! Connection restored.".into())).await; // Send an immediate Ping so the UI updates without a 60s delay - for session in new_sessions.iter_mut() { + for session in sessions_opt.as_mut().unwrap().iter_mut() { let ts = SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_millis() as u64; let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode()); if let Ok(ProtocolAction::SendDatagram(frame)) = session.machine.on_event(OstpEvent::Outbound(0, ping_payload)) { diff --git a/ostp-client/src/transport/xhttp.rs b/ostp-client/src/transport/xhttp.rs index a01aa57..3ae9044 100644 --- a/ostp-client/src/transport/xhttp.rs +++ b/ostp-client/src/transport/xhttp.rs @@ -184,7 +184,7 @@ impl tokio::io::AsyncRead for RealityStream { } impl tokio::io::AsyncWrite for RealityStream { - fn poll_write(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>, buf: &[u8]) -> Poll> { + fn poll_write(self: Pin<&mut Self>, cx: &mut TaskContext<'_>, buf: &[u8]) -> Poll> { let this = self.get_mut(); while !this.tx_buf.is_empty() { match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) { @@ -217,7 +217,7 @@ impl tokio::io::AsyncWrite for RealityStream { } } - fn poll_flush(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll> { let this = self.get_mut(); while !this.tx_buf.is_empty() { match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) { @@ -229,7 +229,7 @@ impl tokio::io::AsyncWrite for RealityStream { Pin::new(&mut this.inner).poll_flush(cx) } - fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll> { let this = self.get_mut(); while !this.tx_buf.is_empty() { match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) {