fix(client): resolve borrow after move error in bridge.rs and clean up warnings

This commit is contained in:
ospab 2026-05-30 22:09:23 +03:00
parent 9f143f730a
commit 0fdea7ee21
2 changed files with 5 additions and 5 deletions

View File

@ -335,7 +335,7 @@ impl Bridge {
tx.send(UiEvent::Log(start_msg.to_string())).await.ok(); tx.send(UiEvent::Log(start_msg.to_string())).await.ok();
// Send an immediate Ping so the UI updates without a 60s delay // 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 ts = SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_millis() as u64;
let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode()); let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode());
if let Ok(ProtocolAction::SendDatagram(frame)) = session.machine.on_event(OstpEvent::Outbound(0, ping_payload)) { 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; let _ = tx.send(UiEvent::Log("Background reconnect successful! Connection restored.".into())).await;
// Send an immediate Ping so the UI updates without a 60s delay // 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 ts = SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_millis() as u64;
let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode()); let ping_payload = Bytes::from(RelayMessage::Ping(ts).encode());
if let Ok(ProtocolAction::SendDatagram(frame)) = session.machine.on_event(OstpEvent::Outbound(0, ping_payload)) { if let Ok(ProtocolAction::SendDatagram(frame)) = session.machine.on_event(OstpEvent::Outbound(0, ping_payload)) {

View File

@ -184,7 +184,7 @@ impl tokio::io::AsyncRead for RealityStream {
} }
impl tokio::io::AsyncWrite for RealityStream { impl tokio::io::AsyncWrite for RealityStream {
fn poll_write(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>, buf: &[u8]) -> Poll<std::io::Result<usize>> { fn poll_write(self: Pin<&mut Self>, cx: &mut TaskContext<'_>, buf: &[u8]) -> Poll<std::io::Result<usize>> {
let this = self.get_mut(); let this = self.get_mut();
while !this.tx_buf.is_empty() { while !this.tx_buf.is_empty() {
match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) { 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<std::io::Result<()>> { fn poll_flush(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll<std::io::Result<()>> {
let this = self.get_mut(); let this = self.get_mut();
while !this.tx_buf.is_empty() { while !this.tx_buf.is_empty() {
match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) { 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) Pin::new(&mut this.inner).poll_flush(cx)
} }
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll<std::io::Result<()>> { fn poll_shutdown(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll<std::io::Result<()>> {
let this = self.get_mut(); let this = self.get_mut();
while !this.tx_buf.is_empty() { while !this.tx_buf.is_empty() {
match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) { match Pin::new(&mut this.inner).poll_write(cx, &this.tx_buf) {